Skip to content

Commit

Permalink
move test after
Browse files Browse the repository at this point in the history
  • Loading branch information
valdrinkoshi authored and TimvdLippe committed Nov 16, 2017
1 parent f03e8d1 commit 4559830
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions test/unit/dom-if.html
Original file line number Diff line number Diff line change
Expand Up @@ -550,27 +550,6 @@

suite('attach/detach tests', function() {

test('remove, append domif', function(done) {
var domif = document.querySelector('#simple');
domif.if = true;
outerContainer.removeChild(domif);
setTimeout(function() {
var clients = outerContainer.querySelectorAll('x-client');
assert.equal(clients.length, 0);
outerContainer.appendChild(domif);
setTimeout(function() {
var clients = outerContainer.querySelectorAll('x-client');
assert.equal(clients[0].uid, 0);
assert.equal(clients[1].uid, 1);
assert.equal(clients[2].uid, 2);
assert.equal(clients[1].previousElementSibling, clients[0]);
assert.equal(clients[2].previousElementSibling, clients[1]);
assert.equal(domif.previousElementSibling, clients[2]);
done();
});
});
});

test('move domif (clients persist)', function(done) {
var domif = document.querySelector('#simple');
domif.if = true;
Expand Down Expand Up @@ -674,6 +653,28 @@
});
});

test('remove, append domif', function(done) {
var domif = document.querySelector('#simple');
var parent = domif.parentNode;
domif.if = true;
parent.removeChild(domif);
setTimeout(function() {
var clients = parent.querySelectorAll('x-client');
assert.equal(clients.length, 0);
parent.appendChild(domif);
setTimeout(function() {
var clients = parent.querySelectorAll('x-client');
assert.equal(clients[0].uid, 12);
assert.equal(clients[1].uid, 13);
assert.equal(clients[2].uid, 14);
assert.equal(clients[1].previousElementSibling, clients[0]);
assert.equal(clients[2].previousElementSibling, clients[1]);
assert.equal(domif.previousElementSibling, clients[2]);
done();
});
});
});

test('move into doc fragment', function(done) {
var el = shouldBeRemoved;
assert.equal(el.parentNode, removalContainer);
Expand Down

0 comments on commit 4559830

Please sign in to comment.