-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix PolymerElement.bind to call reflectPropertyToAttribute w/ prop name
This is the fix for issue 14060 Polymer.js fix is at: Polymer/polymer#319 [email protected] Review URL: https://codereview.chromium.org//27417002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@28688 260f80e4-7a28-3924-810f-c04153c831b5
- Loading branch information
1 parent
e795ef6
commit f16f3b7
Showing
4 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:async' show Completer; | ||
import 'dart:html'; | ||
import 'package:unittest/unittest.dart'; | ||
import 'package:unittest/html_config.dart'; | ||
import 'package:polymer/polymer.dart'; | ||
|
||
@CustomTag('my-child-element') | ||
class MyChildElement extends PolymerElement { | ||
@published int camelCase; | ||
@published int lowercase; | ||
|
||
MyChildElement.created() : super.created(); | ||
|
||
// Make this a no-op, so we can verify the initial | ||
// reflectPropertyToAttribute works. | ||
observeAttributeProperty(name) { } | ||
} | ||
|
||
@CustomTag('my-element') | ||
class MyElement extends PolymerElement { | ||
@observable int volume = 11; | ||
|
||
MyElement.created() : super.created(); | ||
} | ||
|
||
main() { | ||
useHtmlConfiguration(); | ||
|
||
setUp(() => Polymer.onReady); | ||
|
||
test('attribute reflected to property name', () { | ||
var child = query('my-element').shadowRoot.query('my-child-element'); | ||
expect(child.lowercase, 11); | ||
expect(child.camelCase, 11); | ||
|
||
expect('11', child.attributes['lowercase']); | ||
expect('11', child.attributes['camelcase']); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>property to attribute reflection with bind</title> | ||
<script src="packages/polymer/boot.js"></script> | ||
<script src="packages/unittest/test_controller.js"></script> | ||
</head> | ||
|
||
<body> | ||
<polymer-element name="my-child-element"> | ||
<template> | ||
<h1>Hello from the child</h1> | ||
<p>The camelCase is {{camelCase}}, attr {{attributes["camelCase"]}}</p> | ||
<p>The lowercase is {{lowercase}}, attr {{attributes["lowercase"]}}</p> | ||
</template> | ||
</polymer-element> | ||
|
||
<polymer-element name="my-element"> | ||
<template> | ||
<h1>Hello from the custom element. The volume is {{volume}}</h1> | ||
<p> | ||
<my-child-element id="child" | ||
camelCase="{{volume}}" lowercase="{{volume}}"></my-child-element> | ||
</p> | ||
</template> | ||
</polymer-element> | ||
|
||
<my-element></my-element> | ||
|
||
<script type="application/dart" src="prop_attr_bind_reflection_test.dart"> | ||
</script> | ||
</body> | ||
</html> |