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

Unified Diff: sky/tests/framework/templates.sky

Issue 850383002: Add two way data binding. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Make it async. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/tests/framework/observe-expected.txt ('k') | sky/tests/framework/templates-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tests/framework/templates.sky
diff --git a/sky/tests/framework/templates.sky b/sky/tests/framework/templates.sky
index aca46d80f4473f5b34c26c98c3c63e6c823d71b1..747d9067bff71d70b43f2a2a51e799493b0bb11b 100644
--- a/sky/tests/framework/templates.sky
+++ b/sky/tests/framework/templates.sky
@@ -131,6 +131,43 @@ describe("SkyElement", function() {
});
});
+ it("should two way bind attributes", function(done) {
+ sandbox.appendChild(element);
+ var checkbox = element.shadowRoot.getElementById("checkbox");
+ assert.isFalse(checkbox.checked);
+ assert.isFalse(element.checked);
+ element.checked = true;
+ assert.isTrue(element.checked);
+ assert.isFalse(checkbox.checked);
+ Promise.resolve().then(function() {
+ assert.isTrue(checkbox.checked);
+ checkbox.checked = false;
+ assert.isFalse(checkbox.checked);
+ return Promise.resolve().then(function() {
+ assert.isFalse(element.checked);
+ assert.isFalse(checkbox.checked);
+ checkbox.checked = true;
+ assert.isTrue(checkbox.checked);
+ return Promise.resolve().then(function() {
+ assert.isTrue(element.checked);
+ element.checked = true;
+ assert.isTrue(element.checked);
+ assert.isTrue(checkbox.checked);
+ element.checked = false;
+ assert.isFalse(element.checked);
+ assert.isTrue(checkbox.checked);
+ return Promise.resolve().then(function() {
+ assert.isFalse(checkbox.checked);
+ assert.isFalse(element.checked);
+ done();
+ });
+ });
+ });
+ }).catch(function(e) {
+ done(e);
+ });
+ });
+
it("should connect template event handlers", function() {
sandbox.appendChild(element);
var inside = element.shadowRoot.getElementById("inside");
@@ -160,4 +197,4 @@ describe("SkyElement", function() {
});
});
</script>
-</sky>
+</sky>
« no previous file with comments | « sky/tests/framework/observe-expected.txt ('k') | sky/tests/framework/templates-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698