Skip to content
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

[CLEANUP] Remove jQuery integration in EventDispatcher #19552

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { RenderingTestCase, moduleFor, runDestroy, runTask } from 'internal-test-helpers';
import { moduleFor, RenderingTestCase, runDestroy, runTask } from 'internal-test-helpers';
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features';
import { action } from '@ember/object';
import { assign } from '@ember/polyfills';
import { Checkbox, TextArea, TextField } from '@ember/-internals/glimmer';
import { set } from '@ember/-internals/metal';
import { TargetActionSupport } from '@ember/-internals/runtime';
import { getElementView, jQueryDisabled, jQuery, TextSupport } from '@ember/-internals/views';
import { getElementView, TextSupport } from '@ember/-internals/views';

import { Component } from '../../utils/helpers';

Expand Down Expand Up @@ -558,18 +558,13 @@ moduleFor(
['@test [DEPRECATED] sends an action with `<Input @enter="foo" />` when <enter> is pressed'](
assert
) {
assert.expect(4);
assert.expect(3);

expectDeprecation(() => {
this.render(`<Input @enter="foo" />`, {
actions: {
foo(value, event) {
foo() {
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand All @@ -583,17 +578,12 @@ moduleFor(
['@test sends an action with `<Input @enter={{action "foo"}} />` when <enter> is pressed'](
assert
) {
assert.expect(2);
assert.expect(1);

this.render(`<Input @enter={{action 'foo'}} />`, {
actions: {
foo(value, event) {
foo() {
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand All @@ -604,20 +594,15 @@ moduleFor(
}

['@test [DEPRECATED] sends an action with `<Input @key-press="foo" />` is pressed'](assert) {
assert.expect(4);
assert.expect(3);

expectDeprecation(() => {
this.render(`<Input @value={{this.value}} @key-press='foo' />`, {
value: 'initial',

actions: {
foo(value, event) {
foo() {
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand All @@ -637,14 +622,9 @@ moduleFor(
value: 'initial',

actions: {
foo(value, event) {
foo() {
triggered++;
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand Down Expand Up @@ -708,17 +688,12 @@ moduleFor(
}

['@test sends `insert-newline` when <enter> is pressed'](assert) {
assert.expect(2);
assert.expect(1);

this.render(`<Input @insert-newline={{action 'foo'}} />`, {
actions: {
foo(value, event) {
foo() {
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand All @@ -731,18 +706,13 @@ moduleFor(
['@test [DEPRECATED] sends an action with `<Input @escape-press="foo" />` when <escape> is pressed'](
assert
) {
assert.expect(4);
assert.expect(3);

expectDeprecation(() => {
this.render(`<Input @escape-press='foo' />`, {
actions: {
foo(value, event) {
foo() {
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand All @@ -756,17 +726,12 @@ moduleFor(
['@test sends an action with `<Input @escape-press={{action "foo"}} />` when <escape> is pressed'](
assert
) {
assert.expect(2);
assert.expect(1);

this.render(`<Input @escape-press={{action 'foo'}} />`, {
actions: {
foo(value, event) {
foo() {
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand All @@ -777,18 +742,13 @@ moduleFor(
['@test [DEPRECATED] sends an action with `<Input @key-down="foo" />` when a key is pressed'](
assert
) {
assert.expect(4);
assert.expect(3);

expectDeprecation(() => {
this.render(`<Input @key-down='foo' />`, {
actions: {
foo(value, event) {
foo() {
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand All @@ -808,14 +768,9 @@ moduleFor(
() => {
this.render(`<Input @key-down={{action 'foo'}} />`, {
actions: {
foo(value, event) {
foo() {
triggered++;
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand All @@ -832,18 +787,13 @@ moduleFor(
['@test [DEPRECATED] sends an action with `<Input @key-up="foo" />` when a key is pressed'](
assert
) {
assert.expect(4);
assert.expect(3);

expectDeprecation(() => {
this.render(`<Input @key-up='foo' />`, {
actions: {
foo(value, event) {
foo() {
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand All @@ -863,14 +813,9 @@ moduleFor(
() => {
this.render(`<Input @key-up={{action 'foo'}} />`, {
actions: {
foo(value, event) {
foo() {
triggered++;
assert.ok(true, 'action was triggered');
if (jQueryDisabled) {
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
},
},
});
Expand Down
Loading