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

Fix test-support export & remove deprecated code #1625

Merged
merged 2 commits into from
Jan 2, 2024
Merged
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
1 change: 0 additions & 1 deletion ember-power-select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@
"./helpers/ember-power-select-is-group.js": "./dist/_app_/helpers/ember-power-select-is-group.js",
"./helpers/ember-power-select-is-selected.js": "./dist/_app_/helpers/ember-power-select-is-selected.js",
"./test-support/helpers.js": "./dist/_app_/test-support/helpers.js",
"./test-support/index.js": "./dist/_app_/test-support/index.js",
"./utils/computed-fallback-if-undefined.js": "./dist/_app_/utils/computed-fallback-if-undefined.js",
"./utils/group-utils.js": "./dist/_app_/utils/group-utils.js"
}
Expand Down
92 changes: 0 additions & 92 deletions ember-power-select/src/test-support/helpers.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import { deprecate } from '@ember/debug';
import { registerAsyncHelper } from '@ember/test';
import {
click,
fillIn,
triggerKeyEvent,
triggerEvent,
} from '@ember/test-helpers';
import {
selectChoose as _selectChoose,
selectSearch as _selectSearch,
removeMultipleOption as _removeMultipleOption,
clearSelected as _clearSelected,
getDropdownItems as _getDropdownItems,
} from './index';
/**
* @private
* @param {String} selector CSS3 selector of the elements to check the content
Expand Down Expand Up @@ -75,86 +66,3 @@ export async function nativeTouch(selectorOrDomElement) {
export async function touchTrigger() {
return nativeTouch('.ember-power-select-trigger');
}

export async function selectChoose(
cssPathOrTrigger,
valueOrSelector,
optionIndex,
) {
return _selectChoose(cssPathOrTrigger, valueOrSelector, optionIndex);
}

/* *
* @param {String} selector CSS3 selector of the elements to check the content
* @returns {Array} returns all the elements present in the dropdown
*
* Usage in tests:
* let options = await getDropdownItems('.ember-power-select-trigger');
* assert.deepEqual(options, [1, 2, 3]);
* */
export async function getDropdownItems(cssPathOrTrigger) {
return _getDropdownItems(cssPathOrTrigger);
}

export async function selectSearch(cssPathOrTrigger, value) {
return _selectSearch(cssPathOrTrigger, value);
}

export async function removeMultipleOption(cssPath, value) {
return _removeMultipleOption(cssPath, value);
}

export async function clearSelected(cssPath) {
return _clearSelected(cssPath);
}

// Helpers for acceptance tests
export default function () {
registerAsyncHelper(
'selectChoose',
function (_, cssPathOrTrigger, valueOrSelector, optionIndex) {
deprecate(
'Using the implicit global async helper `selectChoose` is deprecated. Please, import it explicitly with `import { selectChoose } from "ember-power-select/test-support"`',
true,
{ id: 'ember-power-select-global-select-choose', until: '2.0.0' },
);
return _selectChoose(cssPathOrTrigger, valueOrSelector, optionIndex);
},
);

registerAsyncHelper(
'selectSearch',
async function (app, cssPathOrTrigger, value) {
deprecate(
'Using the implicit global async helper `selectSearch` is deprecated. Please, import it explicitly with `import { selectSearch } from "ember-power-select/test-support"`',
true,
{ id: 'ember-power-select-global-select-search', until: '2.0.0' },
);
return _selectSearch(cssPathOrTrigger, value);
},
);

registerAsyncHelper(
'removeMultipleOption',
async function (app, cssPath, value) {
deprecate(
'Using the implicit global async helper `removeMultipleOption` is deprecated. Please, import it explicitly with `import { removeMultipleOption } from "ember-power-select/test-support"`',
true,
{
id: 'ember-power-select-global-remove-multiple-option',
until: '2.0.0',
},
);
return _removeMultipleOption(cssPath, value);
},
);

registerAsyncHelper('clearSelected', async function (app, cssPath) {
deprecate(
'Using the implicit global async helper `clearSelected` is deprecated. Please, import it explicitly with `import { clearSelected } from "ember-power-select/test-support"`',
true,
{ id: 'ember-power-select-global-clear-selected', until: '2.0.0' },
);
return _clearSelected(cssPath);
});
}
2 changes: 1 addition & 1 deletion test-app/tests/acceptance/helpers-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
selectSearch,
removeMultipleOption,
clearSelected,
} from 'ember-power-select/test-support/helpers';
} from 'ember-power-select/test-support';

module('Acceptance | helpers | selectChoose', function (hooks) {
setupApplicationTest(hooks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { hbs } from 'ember-cli-htmlbars';
import {
selectChoose,
getDropdownItems,
} from 'ember-power-select/test-support/helpers';
} from 'ember-power-select/test-support';
import { numbers } from '../constants';

module('Integration | Helpers | selectChoose', function (hooks) {
Expand Down