-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "computed" and "observer" attribute to @property decorator #18
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
This should probably be renamed as its actually support for Looks good though, nice PR 👍 |
src/decorators.ts
Outdated
@@ -38,6 +38,7 @@ export interface PropertyOptions { | |||
notify?: boolean; | |||
reflectToAttribute?: boolean; | |||
readOnly?: boolean; | |||
computed: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be optional like the others
@aomarks can we get this merged? @danielvanmil can you rebase onto master to resolve the conflicts? maybe while you're in here too, it could be worth adding |
CHANGELOG.md
Outdated
@@ -2,6 +2,12 @@ | |||
|
|||
## [Unreleased] | |||
|
|||
## [0.1.2-alpha.2] - 2017-11-28 | |||
- Added "observer" attribute to @property annotation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move both items to the unreleased
section and remove these alpha releases?
bower.json
Outdated
@@ -1,7 +1,7 @@ | |||
{ | |||
"name": "polymer-decorators", | |||
"homepage": "https://github.com/Polymer/polymer-decorators", | |||
"version": "0.1.1", | |||
"version": "0.1.2-alpha.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't modify version.
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@polymer/decorators", | |||
"version": "0.1.1", | |||
"version": "0.1.2-alpha.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't modify version.
src/decorators.ts
Outdated
@@ -52,7 +54,9 @@ export function property(options?: PropertyOptions) { | |||
const reflectToAttribute: boolean = | |||
options && options.reflectToAttribute || false; | |||
const readOnly: boolean = options && options.readOnly || false; | |||
|
|||
const computed: string = options && options.computed || ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run npm run format
? Should switch quotes to single.
rebased |
processed "code review" |
@43081j: please merge |
test/integration/decorators.ts
Outdated
@@ -74,6 +74,18 @@ suite('TypeScript Decorators', function() { | |||
const propValue = testElement.readOnlyString; | |||
chai.assert.equal(propValue, 'initial value'); | |||
}); | |||
|
|||
test('computed property should should return computed value', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a tiny typo here, should should
test/integration/decorators.ts
Outdated
@@ -74,6 +74,18 @@ suite('TypeScript Decorators', function() { | |||
const propValue = testElement.readOnlyString; | |||
chai.assert.equal(propValue, 'initial value'); | |||
}); | |||
|
|||
test('computed property should should return computed value', function() { | |||
testElement.computedString = "new value"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess this should be setting reflectedString
to yahoo
? so the following computed result is computed yahoo
? by the looks of the test element source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
@@ -9,7 +9,7 @@ | |||
* rights grant found at http://polymer.github.io/PATENTS.txt | |||
*/ | |||
|
|||
/// <reference path="../bower_components/polymer-decorators/global.d.ts" /> | |||
/// <reference path="bower_components/polymer-decorators/global.d.ts" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your build fails because this path can't be found, probably just needs setting back to ../
?
@@ -18,9 +18,6 @@ class TestElement extends Polymer.Element { | |||
@property({notify: true}) | |||
aNum: number = 42; | |||
|
|||
@property() | |||
doesntNotify: boolean = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a failing test causing your build to fail which depends on this. maybe just restore this property
added a couple of comments to help you get the CI build passing. but other than those small changes, looks good to me. @aomarks can merge if he approves too |
Merged. Thanks @danielvanmil and @43081j ! |
Add @computedProperty decorator