ticketfly / ember-hook Goto Github PK
View Code? Open in Web Editor NEWYerrr tests be brittle, mattie!!!
License: MIT License
Yerrr tests be brittle, mattie!!!
License: MIT License
The README talks about two ways of adding hooks:
This also works, but is not documented:
It adds an additional &^%^&
to the end:
<div class='my-component data-test='a&^%^&b=c&^%^&&^%^&'>
but the hook
and $hook
test helpers don't seem to care about that.
If this is something we should expect to work, let's document and test it. If it's not supposed to work, perhaps we should assert that the hook
attribute's value doesn't itself contain &^%^&
.
You cannot use attributeBindings on tagless components, which this reopens component and therefore does if you use any tagless components.
My solution only works in > 2.0.0 so I need to explore other options..
ember-get-config has been updated lately because of some gamebreaking NPM errors. It should be updated to 0.1.7
or use getOwner as the documantation suggests.
Edit: PR pending
I've been using ember-hook successfully, but today I tried installing ember-attacher and as soon as I add a tooltip to the page, I get an error message in the console:
You cannot use attributeBindings on a tag-less component :ember-popper
Looking at the ember-popper component, it has a tagName of '' (empty-string) so it makes sense this error is thrown. However, is there any workaround for this scenario? The ember-popper component has an elementId, so the hooked mixin tries to apply the binding
Currently, the default enabled state of ember-hook
is when the environment is set to "test" which works fine if one is running ember test
or ember test --server
.
If one is running ember serve
and navigating to http://localhost:4200/tests
then the environment is "development" and ember-hook
is not enabled by default and requires the environments to be set.
emberHook: {
enabled: environment === 'development' || environment === 'test'
},
Have ember-hook
recognize both the "test" and "development" environments as defaults.
Hi,
I've been using ember-hook 1.3.1 with {{input}}
helpers by following
http://emberjs.com/api/classes/Ember.Templates.helpers.html#toc_extending-code-ember-textfield-code,
i.e. doing
Ember.TextField.reopen({
attributeBindings: ['data-test'],
});
in an initializer, and then doing {{input data-helper=(hook "myTextField")}}
in my templates.
This does not work in 1.3.2 any longer, so maybe the version bump should indicate a breaking change (i.e. version 2.0.0)?
The workaround that is maybe worth documenting in your README is now to simply use {{input hook=(hook "myTextField")}}
in templates without any need to reopen the Ember.TextField
component.
If a unit test runs in isolation, the hooks will not work.
This occurs on adopted-ember-addons/ember-keyboard#87
(ember-keyboard)
but it may have something to do with ember 3.3? I have no idea
Currently, we bind data-test
to a component's testHook
property. This runs counter to our helper method, which is simply named hook
. Perhaps we should have a consistent name hook
throughout?
On the other hand, I'm worried about using such a generic property name. There's a greater chance that it'll conflict with other addons or pre-existing apps.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.