OLD | NEW |
1 <html> | 1 <html> |
2 <link rel="import" href="../resources/chai.sky" /> | 2 <import src="../resources/chai.sky" /> |
3 <link rel="import" href="../resources/mocha.sky" /> | 3 <import src="../resources/mocha.sky" /> |
4 <script> | 4 <script> |
5 describe('Transient registrations', function() { | 5 describe('Transient registrations', function() { |
6 it('should be cleared even without delivery', function(done) { | 6 it('should be cleared even without delivery', function(done) { |
7 var mutationsDelivered = false; | 7 var mutationsDelivered = false; |
8 var observer = new MutationObserver(function(mutations) { | 8 var observer = new MutationObserver(function(mutations) { |
9 mutationsDelivered = true; | 9 mutationsDelivered = true; |
10 }); | 10 }); |
11 var div = document.createElement('div'); | 11 var div = document.createElement('div'); |
12 var span = div.appendChild(document.createElement('span')); | 12 var span = div.appendChild(document.createElement('span')); |
13 observer.observe(div, {attributes: true, subtree: true}); | 13 observer.observe(div, {attributes: true, subtree: true}); |
14 div.removeChild(span); | 14 div.removeChild(span); |
15 setTimeout(function() { | 15 setTimeout(function() { |
16 // By the time this function runs the transient registration should | 16 // By the time this function runs the transient registration should |
17 // be cleared, so we expect not to be notified of this attribute | 17 // be cleared, so we expect not to be notified of this attribute |
18 // mutation. | 18 // mutation. |
19 span.setAttribute('bar', 'baz'); | 19 span.setAttribute('bar', 'baz'); |
20 setTimeout(function() { | 20 setTimeout(function() { |
21 assert.notOk(mutationsDelivered); | 21 assert.notOk(mutationsDelivered); |
22 done(); | 22 done(); |
23 }, 0); | 23 }, 0); |
24 }, 0); | 24 }, 0); |
25 }); | 25 }); |
26 }); | 26 }); |
27 </script> | 27 </script> |
28 </html> | 28 </html> |
OLD | NEW |