mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix detached callback and add isAttached to SkyElements.
There was a typo in the name of the detached callback which is now fixed, and also allow querying if an element is attached. R=rafaelw@chromium.org Review URL: https://codereview.chromium.org/806133003
This commit is contained in:
parent
0333bd80a7
commit
ceb4dbc927
@ -36,7 +36,7 @@ class SkyElement extends HTMLElement {
|
||||
// override
|
||||
}
|
||||
|
||||
dettached() {
|
||||
detached() {
|
||||
// override
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ class SkyElement extends HTMLElement {
|
||||
}
|
||||
|
||||
createdCallback() {
|
||||
this.isAttached = false;
|
||||
this.created();
|
||||
}
|
||||
|
||||
@ -63,10 +64,12 @@ class SkyElement extends HTMLElement {
|
||||
}
|
||||
}
|
||||
this.attached();
|
||||
this.isAttached = true;
|
||||
}
|
||||
|
||||
dettachedCallback() {
|
||||
this.dettached();
|
||||
detachedCallback() {
|
||||
this.detached();
|
||||
this.isAttached = false;
|
||||
}
|
||||
|
||||
attributeChangedCallback(attrName, oldValue, newValue) {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
Running 4 tests
|
||||
Running 5 tests
|
||||
ok 1 SkyElement templates should stamp when the element is inserted
|
||||
ok 2 SkyElement templates should connect data binding
|
||||
ok 3 SkyElement templates should connect event handlers
|
||||
ok 4 SkyElement templates should call shadowRootReady after creating the template instance
|
||||
4 tests
|
||||
4 pass
|
||||
ok 2 SkyElement templates should update isAttached when inserting
|
||||
ok 3 SkyElement templates should connect data binding
|
||||
ok 4 SkyElement templates should connect event handlers
|
||||
ok 5 SkyElement templates should call shadowRootReady after creating the template instance
|
||||
5 tests
|
||||
5 pass
|
||||
0 fail
|
||||
|
||||
@ -24,6 +24,14 @@ describe("SkyElement templates", function() {
|
||||
assert.ok(element.shadowRoot.getElementById("inside"));
|
||||
});
|
||||
|
||||
it("should update isAttached when inserting", function() {
|
||||
assert.isFalse(element.isAttached);
|
||||
sandbox.appendChild(element);
|
||||
assert.isTrue(element.isAttached);
|
||||
element.remove();
|
||||
assert.isFalse(element.isAttached);
|
||||
});
|
||||
|
||||
it("should connect data binding", function(done) {
|
||||
sandbox.appendChild(element);
|
||||
var inside = element.shadowRoot.getElementById("inside");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user