Skip to content

Commit bbd093b

Browse files
committed
Remove special handling of inner find call for click transform
became error prone (missing or duplicate imports), and harder to maintain. Also no reason to add special handling to only click, and not to other helpers as well.
1 parent 4249572 commit bbd093b

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

__testfixtures__/integration/click.output.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { findAll, click } from '@ember/test-helpers';
1+
import { find, findAll, click } from '@ember/test-helpers';
22
import { moduleForComponent, test } from 'ember-qunit';
33
import hbs from 'htmlbars-inline-precompile';
44

@@ -10,7 +10,7 @@ test('it renders', async function(assert) {
1010
this.render(hbs`{{foo-bar}}`);
1111

1212
await click('.foo');
13-
await click('.baz a');
13+
await click(find('.baz a'));
1414
await click(findAll('.foo .bar')[3]);
1515
assert.ok(true);
1616
});

lib/utils.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function migrateSelector(j, selector) {
132132
selector.value = query;
133133
if (eqIndex === '0') {
134134
// findAll('*')[0] === find('*')
135-
// addImportStatement(['find']);
135+
addImportStatement(['find']);
136136
return createFindExpression(j, [selector]);
137137
} else {
138138
addImportStatement(['findAll']);
@@ -262,16 +262,6 @@ function isQuerySelectorAllCallExpression(j, node) {
262262
function createClickExpression(j, args) {
263263
args = args.map(s => migrateSelector(j, s));
264264

265-
// Collapse inner find call
266-
let isFindCallExpression = args.length === 1
267-
&& j.CallExpression.check(args[0])
268-
&& j.Identifier.check(args[0].callee)
269-
&& args[0].callee.name === 'find';
270-
271-
if (isFindCallExpression) {
272-
args[0] = args[0].arguments[0];
273-
}
274-
275265
return j.awaitExpression(
276266
j.callExpression(
277267
j.identifier('click'),

0 commit comments

Comments
 (0)