Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
use MutationObserver in Update Ref test, fixes #184
Browse files Browse the repository at this point in the history
  • Loading branch information
John Messerly committed Aug 13, 2014
1 parent 1db2fa1 commit f150942
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1582,15 +1582,19 @@ suite('Template Instantiation', function() {
assert.strictEqual(4, div.childNodes.length);
assert.strictEqual('Hi, Fry', div.childNodes[3].textContent);

div.childNodes[2].setAttribute('ref', 'B');
// In IE 11, MutationObservers do not fire before setTimeout.
// So rather than using "then" to queue up the next test, we use a
// MutationObserver here to detect the change to "ref".
new MutationObserver(function() {
assert.strictEqual(5, div.childNodes.length);
assert.strictEqual('Hola, Fry', div.childNodes[3].textContent);
assert.strictEqual('Hola, Leela', div.childNodes[4].textContent);

done();
}).observe(template, { attributes: true, attributeFilter: ['ref'] });

template.setAttribute('ref', 'B');
model.push('Leela');

}).then(function() {
assert.strictEqual(5, div.childNodes.length);
assert.strictEqual('Hola, Fry', div.childNodes[3].textContent);
assert.strictEqual('Hola, Leela', div.childNodes[4].textContent);

done();
});
});

Expand Down

0 comments on commit f150942

Please sign in to comment.