Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Created April 12, 2016 08:35
Show Gist options
  • Save GavinJoyce/4570f56ccce5e946bb1d45c04c06b56d to your computer and use it in GitHub Desktop.
Save GavinJoyce/4570f56ccce5e946bb1d45c04c06b56d to your computer and use it in GitHub Desktop.
tests
//TODO: GJ: why is this failing?
['@skip specifying `on="someevent" action="foo"` results in a deprecation warning and triggers an action']() {
let fooBarInstance;
let actionCount = 0;
let FooBarComponent = Component.extend({
init() {
this._super();
fooBarInstance = this;
},
actions: {
doFoo: function() {
actionCount++;
}
}
});
expectDeprecation(() => {
this.registerComponent('foo-bar', {
ComponentClass: FooBarComponent,
template: `{{input on="focus-in" action="doFoo" value="hello"}}`
});
}, `Using '{{input on="focus-in" action="doFoo"}}' (L1:C0) is deprecated. Please use '{{input focus-in="doFoo"}}' instead.`);
this.render(`{{foo-bar}}`);
this.assert.equal(actionCount, 0);
this.runTask(() => fooBarInstance.$('input').trigger('focusin')); //TODO: GJ: this does not seem to be triggering the action
this.assert.equal(actionCount, 1);
}
//TODO: GJ: why is this failing?
['@skip `{{input focus-in="doFoo"}}` triggers an action']() {
let fooBarInstance;
let actionCount = 0;
let FooBarComponent = Component.extend({
init() {
this._super();
fooBarInstance = this;
},
actions: {
doFoo: function() {
actionCount++;
}
}
});
this.registerComponent('foo-bar', {
ComponentClass: FooBarComponent,
template: `{{input focus-in="doFoo" key-press="doFoo" value="hello"}}`
});
this.render(`{{foo-bar}}`);
this.assert.equal(actionCount, 0);
this.runTask(() => fooBarInstance.$('input').trigger('focusin')); //TODO: GJ: this does not seem to be triggering the action
this.assert.equal(actionCount, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment