Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Remove bogus Platform.flush() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott J. Miles committed Jul 24, 2014
1 parent dee245c commit 448959f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions test/html/prop-attr-reflection.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
xfoo.foo = 5;
xfoo.setAttribute('def1', '15');
xfoo.def2 = 15;
Platform.flush();
//
assert.isFalse(xcompose.$.bar.hasAttribute('zim'), 'attribute bound to property updates when binding is made');
assert.equal(xfoo.getAttribute('def2'), '15', 'default valued published property reflects to attr');
assert.equal(xfoo.def1, '15', 'attr updates default valued published property');
Expand All @@ -94,7 +94,7 @@
assert.equal(xfoo.foo, xfoo.getAttribute('foo'), 'property reflects attribute');
//
xfoo.baz = 'Hello';
Platform.flush();
//
assert.equal(xfoo.baz, xfoo.getAttribute('baz'), 'attribute reflects property');
//
var xbar = document.querySelector('x-bar');
Expand All @@ -104,45 +104,51 @@
xbar.zim = true;
xbar.str = 'str!';
xbar.obj = {hello: 'world'};
Platform.flush();
//
assert.equal(xbar.foo, xbar.getAttribute('foo'), 'inherited published property is reflected');
assert.equal(String(xbar.zot), xbar.getAttribute('zot'), 'attribute reflects property as number');
assert.equal(xbar.getAttribute('zim'), '', 'attribute reflects true valued boolean property as having attribute');
assert.equal(xbar.str, xbar.getAttribute('str'), 'attribute reflects property as published string');
assert.isFalse(xbar.hasAttribute('obj'), 'attribute does not reflect object property');
//
xbar.setAttribute('zim', 'false');
xbar.setAttribute('foo', 'foo!!');
xbar.setAttribute('zot', 54);
xbar.setAttribute('str', 'str!!');
xbar.setAttribute('obj', "{'hello': 'world'}");
//
assert.equal(xbar.foo, xbar.getAttribute('foo'), 'property reflects attribute as string');
assert.equal(xbar.zot, 54, 'property reflects attribute as number');
assert.equal(xbar.zim, false, 'property reflects attribute as boolean');
assert.equal(xbar.str, 'str!!', 'property reflects attribute as published string');
assert.deepEqual(xbar.obj, {hello: 'world'}, 'property reflects attribute as object');
//
xbar.zim = false;
Platform.flush();
//
assert.isFalse(xbar.hasAttribute('zim'), 'attribute reflects false valued boolean property as NOT having attribute');
//
var objAttr = xbar.getAttribute('obj');
oneMutation(xbar, {attributes: true}, function() {
assert.equal(xbar.getAttribute('obj'), 'hi', 'reflect property based on current type');
//assert.isFalse(xbar.hasAttribute('obj'), 'property with default type of object does not serialize');
done();
});

//
var xzot = document.querySelector('x-zot');
assert.equal(xzot.str, 'str2');
xzot.str = 'hello';
assert.equal(xzot.getAttribute('str'), xzot.str);

//
assert.equal(xzot.zot, 2);
xzot.zot = 5;
assert.isFalse(xzot.hasAttribute('zot'), 'extendee reflect false not honored');

//
xbar.obj = 'hi';
Platform.flush();
// trigger a mutation to watch
xbar.setAttribute('dummy', 'dummy');
//
// don't let observe polyfill wait, flush asap
Platform.flush();
});
</script>
</body>
Expand Down

0 comments on commit 448959f

Please sign in to comment.