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

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

Issue 810793005: Implement Node.ownerScope (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Update to spec. Created 6 years 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
« no previous file with comments | « sky/engine/core/dom/Node.idl ('k') | sky/tests/dom/ownerScope-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <sky>
2 <import src="../resources/chai.sky" />
3 <import src="../resources/mocha.sky" />
4 <script>
5 describe("ownerScope", function() {
6 it("should return null for elements not a child of a scope", function() {
7 var doc = new Document();
8 var element = doc.createElement("div");
9 assert.isNull(element.ownerScope);
10 });
11 it("should return the document for elements in the document scope", function() {
12 var doc = new Document();
13 var element = doc.createElement("div");
14 doc.appendChild(element);
15 assert.equal(element.ownerScope, element.ownerDocument);
16 assert.equal(element.ownerScope, doc);
17 });
18 it("should return the shadow root for elements in the shadow root scope", func tion() {
19 var doc = new Document();
20 var host = doc.createElement("div");
21 var child = doc.createElement("div");
22 var shadowRoot = host.ensureShadowRoot();
23 shadowRoot.appendChild(child);
24 assert.equal(child.ownerScope, shadowRoot);
25 });
26 it("should return self for a shadow root or document", function() {
27 var doc = new Document();
28 var host = doc.createElement("div");
29 doc.appendChild(host);
30 var shadowRoot = host.ensureShadowRoot();
31 assert.equal(shadowRoot.ownerScope, shadowRoot);
32 assert.equal(doc.ownerScope, doc);
33 });
34 it("should dynamically update", function() {
35 var doc = new Document();
36 var host = doc.createElement("div");
37 var child = doc.createElement("div");
38 var shadowRoot = host.ensureShadowRoot();
39 assert.equal(child.ownerScope, null);
40 shadowRoot.appendChild(child);
41 assert.equal(child.ownerScope, shadowRoot);
42 child.remove();
43 assert.equal(child.ownerScope, null);
44 });
45 });
46 </script>
47 </sky>
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Node.idl ('k') | sky/tests/dom/ownerScope-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698