Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: sky/tests/dom/ownerScope.sky

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <sky> 1 <sky>
2 <import src="../resources/chai.sky" />
3 <import src="../resources/mocha.sky" />
4 <script> 2 <script>
5 describe("ownerScope", function() { 3 import "../resources/third_party/unittest/unittest.dart";
6 it("should return null for elements not a child of a scope", function() { 4 import "../resources/unit.dart";
5
6 import "dart:sky";
7
8 void main() {
9 initUnit();
10
11 test("should return null for elements not a child of a scope", () {
7 var doc = new Document(); 12 var doc = new Document();
8 var element = doc.createElement("div"); 13 var element = doc.createElement("div");
9 assert.isNull(element.ownerScope); 14 expect(element.ownerScope, isNull);
10 }); 15 });
11 it("should return the document for elements in the document scope", function() { 16 test("should return the document for elements in the document scope", () {
12 var doc = new Document(); 17 var doc = new Document();
13 var element = doc.createElement("div"); 18 var element = doc.createElement("div");
14 doc.appendChild(element); 19 doc.appendChild(element);
15 assert.equal(element.ownerScope, element.ownerDocument); 20 expect(element.ownerScope, equals(element.ownerDocument));
16 assert.equal(element.ownerScope, doc); 21 expect(element.ownerScope, equals(doc));
17 }); 22 });
18 it("should return the shadow root for elements in the shadow root scope", func tion() { 23 test("should return the shadow root for elements in the shadow root scope", () {
19 var doc = new Document(); 24 var doc = new Document();
20 var host = doc.createElement("div"); 25 var host = doc.createElement("div");
21 var child = doc.createElement("div"); 26 var child = doc.createElement("div");
22 var shadowRoot = host.ensureShadowRoot(); 27 var shadowRoot = host.ensureShadowRoot();
23 shadowRoot.appendChild(child); 28 shadowRoot.appendChild(child);
24 assert.equal(child.ownerScope, shadowRoot); 29 expect(child.ownerScope, equals(shadowRoot));
25 }); 30 });
26 it("should return self for a shadow root or document", function() { 31 test("should return self for a shadow root or document", () {
27 var doc = new Document(); 32 var doc = new Document();
28 var host = doc.createElement("div"); 33 var host = doc.createElement("div");
29 doc.appendChild(host); 34 doc.appendChild(host);
30 var shadowRoot = host.ensureShadowRoot(); 35 var shadowRoot = host.ensureShadowRoot();
31 assert.equal(shadowRoot.ownerScope, shadowRoot); 36 expect(shadowRoot.ownerScope, equals(shadowRoot));
32 assert.equal(doc.ownerScope, doc); 37 expect(doc.ownerScope, equals(doc));
33 }); 38 });
34 it("should dynamically update", function() { 39 test("should dynamically update", () {
35 var doc = new Document(); 40 var doc = new Document();
36 var host = doc.createElement("div"); 41 var host = doc.createElement("div");
37 var child = doc.createElement("div"); 42 var child = doc.createElement("div");
38 var shadowRoot = host.ensureShadowRoot(); 43 var shadowRoot = host.ensureShadowRoot();
39 assert.equal(child.ownerScope, null); 44 expect(child.ownerScope, isNull);
40 shadowRoot.appendChild(child); 45 shadowRoot.appendChild(child);
41 assert.equal(child.ownerScope, shadowRoot); 46 expect(child.ownerScope, equals(shadowRoot));
42 child.remove(); 47 child.remove();
43 assert.equal(child.ownerScope, null); 48 expect(child.ownerScope, isNull);
44 }); 49 });
45 }); 50 }
46 </script> 51 </script>
47 </sky> 52 </sky>
OLDNEW
« no previous file with comments | « sky/tests/dom/document-child-mutations-expected.txt ('k') | sky/tests/dom/ownerScope-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698