Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ganlanyuan committed Aug 9, 2018
1 parent 2d9501e commit e0f0548
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 80 deletions.
24 changes: 11 additions & 13 deletions tests/js/tests-async-es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1406,10 +1406,8 @@ function testResponsive5() {
case 0:
_context11.prev = 0;
doc = newWindow.contentDocument ? newWindow.contentDocument : newWindow.contentWindow.document, wrapper = doc.querySelector('#' + id + '-iw'), container = doc.querySelector('#' + id), first = container.querySelector('#' + id + '-item0');
_context11.next = 4;
return wait(1000);

case 4:

assertionFixedWidth = first.clientWidth === getFW(windowWidth) && wrapper.getBoundingClientRect().left === first.getBoundingClientRect().left;
assertionAutoHeight = wrapper.style.height === '';
if (!assertionFixedWidth) {
Expand All @@ -1422,10 +1420,10 @@ function testResponsive5() {
// resize window
windowWidth = Number(bps[0]) + 20;
newWindow.style.width = windowWidth + 'px';
_context11.next = 12;
_context11.next = 10;
return wait(2000);

case 12:
case 10:
if (assertionFixedWidth) {
assertionFixedWidth = first.clientWidth === getFW(windowWidth) + 100 && wrapper.getBoundingClientRect().left === first.getBoundingClientRect().left;
if (!assertionFixedWidth) {
Expand All @@ -1441,28 +1439,28 @@ function testResponsive5() {

updateTest(testFixedWidthT, assertionFixedWidth, commentFixedWidth);
updateTest(testAutoHeightT, assertionAutoHeight, commentAutoHeight);
_context11.next = 22;
_context11.next = 20;
break;

case 18:
_context11.prev = 18;
case 16:
_context11.prev = 16;
_context11.t0 = _context11['catch'](0);

testFixedWidthT.className = 'item-notsure';
testAutoHeightT.className = 'item-notsure';

case 22:
_context11.prev = 22;
case 20:
_context11.prev = 20;

body.removeChild(newWindow);
return _context11.finish(22);
return _context11.finish(20);

case 25:
case 23:
case 'end':
return _context11.stop();
}
}
}, _callee11, this, [[0, 18, 22, 25]]);
}, _callee11, this, [[0, 16, 20, 23]]);
}));

return function responsive5Tests() {
Expand Down
1 change: 0 additions & 1 deletion tests/js/tests-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,6 @@ function testResponsive5 () {
container = doc.querySelector('#' + id),
first = container.querySelector('#' + id + '-item0');

await wait(1000);
assertionFixedWidth = first.clientWidth === getFW(windowWidth) &&
wrapper.getBoundingClientRect().left === first.getBoundingClientRect().left;
assertionAutoHeight = wrapper.style.height === '';
Expand Down
45 changes: 15 additions & 30 deletions tests/responsive5-mobile.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,45 +29,30 @@ <h2>
Responsive5
</h2>
<div class="responsive5" id="responsive5">
<div>
<div>
<img src="https://via.placeholder.com/700x500" alt="" width="700" height="500">
<div class="item">
<div class="img img-1" style="height: 500px;">
<a href="">0</a>
</div>
<p>
Sunt dignissimos distinctio, veniam, tenetur aspernatur nulla!
</p>
</div>
<div>
<div>
<img src="https://via.placeholder.com/700x700" alt="" width="700" height="700">
<div class="item">
<div class="img img-2" style="height: 700px;">
<a href="">1</a>
</div>
<p>
Corrupti, libero minima nihil expedita officiis? Quo.
</p>
</div>
<div>
<div>
<img src="https://via.placeholder.com/700x600" alt="" width="700" height="600">
<div class="item">
<div class="img img-3" style="height: 600px;">
<a href="">2</a>
</div>
<p>
Alias rem, ab impedit recusandae repellat tempore.
</p>
</div>
<div>
<div>
<img src="https://via.placeholder.com/700x800" alt="" width="700" height="800">
<div class="item">
<div class="img img-4" style="height: 800px;">
<a href="">3</a>
</div>
<p>
Nisi inventore quo delectus perspiciatis voluptatibus, quae.
</p>
</div>
<div>
<div>
<img src="https://via.placeholder.com/700x500" alt="" width="700" height="500">
<div class="item">
<div class="img img-5" style="height: 500px;">
<a href="">4</a>
</div>
<p>
Nisi harum earum consectetur laudantium iusto, laboriosam.
</p>
</div>
</div>
</div>
Expand Down
45 changes: 15 additions & 30 deletions tests/responsive5.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,45 +29,30 @@ <h2>
Responsive5
</h2>
<div class="responsive5" id="responsive5">
<div>
<div>
<img src="https://source.unsplash.com/collection/993239/1600x500" alt="" width="1600" height="500">
<div class="item">
<div class="img img-1" style="height: 500px;">
<a href="">0</a>
</div>
<p>
Sunt dignissimos distinctio, veniam, tenetur aspernatur nulla!
</p>
</div>
<div>
<div>
<img src="https://source.unsplash.com/collection/1673600/1600x700" alt="" width="1600" height="700">
<div class="item">
<div class="img img-2" style="height: 700px;">
<a href="">1</a>
</div>
<p>
Corrupti, libero minima nihil expedita officiis? Quo.
</p>
</div>
<div>
<div>
<img src="https://source.unsplash.com/collection/1513994/1600x600" alt="" width="1600" height="600">
<div class="item">
<div class="img img-3" style="height: 600px;">
<a href="">2</a>
</div>
<p>
Alias rem, ab impedit recusandae repellat tempore.
</p>
</div>
<div>
<div>
<img src="https://source.unsplash.com/collection/502925/1600x800" alt="" width="1600" height="800">
<div class="item">
<div class="img img-4" style="height: 800px;">
<a href="">3</a>
</div>
<p>
Nisi inventore quo delectus perspiciatis voluptatibus, quae.
</p>
</div>
<div>
<div>
<img src="https://source.unsplash.com/collection/1891993/1600x500" alt="" width="1600" height="500">
<div class="item">
<div class="img img-5" style="height: 500px;">
<a href="">4</a>
</div>
<p>
Nisi harum earum consectetur laudantium iusto, laboriosam.
</p>
</div>
</div>
</div>
Expand Down
20 changes: 14 additions & 6 deletions tests/templates/parts/layout.njk
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,20 @@
{% elif slide === 'autoHeight' or slide === 'responsive5' %}
{% set w = 700 if mobile else 1600 %}
{% set hs = [500, 700, 600, 800, 500, 600, 800] %}
{% for i in range(1, 6) %}
<div>
<div><img src="{{ baseurl }}{{ collectionId[i - 1] }}/{{ w }}x{{ hs[i-1] }}" alt="" width="{{ w }}" height="{{ hs[i-1] }}"></div>
<p>{{ titles[i] }}</p>
</div>
{% endfor %}
{% if slide === 'autoHeight' %}
{% for i in range(1, 6) %}
<div>
<div><img src="{{ baseurl }}{{ collectionId[i - 1] }}/{{ w }}x{{ hs[i-1] }}" alt="" width="{{ w }}" height="{{ hs[i-1] }}"></div>
<p>{{ titles[i] }}</p>
</div>
{% endfor %}
{% else %}
{% for i in range(1, 6) %}
<div class="item">
<div class="img img-{{ i }}" style="height: {{ hs[i-1] }}px;"><a href="">{{ i - 1 }}</a></div>
</div>
{% endfor %}
{% endif %}

{# nested #}
{% elif slide === 'nested' %}
Expand Down

0 comments on commit e0f0548

Please sign in to comment.