Created
November 6, 2017 17:54
-
-
Save magistrula/47c72d60cdc62c1dcb86d993420fb10b to your computer and use it in GitHub Desktop.
ember-cli-page-object `getter` macro
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
import { | |
create, | |
hasClass, | |
isVisible | |
} from 'ember-cli-page-object'; | |
import { getter } from 'ember-cli-page-object/macros'; | |
// the old way | |
const page = create({ | |
foo: isVisible('button'), | |
bar: hasClass('active', 'button') | |
baz: { | |
isDescriptor: true, | |
get() { | |
return this.foo && this.bar; | |
} | |
} | |
}); | |
// the new way | |
const page = create({ | |
foo: isVisible('button'), | |
bar: hasClass('active', 'button') | |
baz: getter(function() { | |
return this.foo && this.bar; | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment