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

Do not warn when selecting a text with comma #521

Merged
merged 2 commits into from
Nov 22, 2020
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
17 changes: 9 additions & 8 deletions addon-test-support/-private/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ class Selector {
scope = this.calculateScope(this.targetNode, this.targetScope);
}

deprecate(
'Usage of comma separated selectors is deprecated in ember-cli-page-object',
`${scope} ${this.targetSelector}`.indexOf(',') === -1, {
id: 'ember-cli-page-object.comma-separated-selectors',
until: "2.0.0",
url: 'https://ember-cli-page-object.js.org/docs/v1.16.x/deprecations/#comma-separated-selectors',
}
);

filters = this.calculateFilters(this.targetFilters);

let selector = $.trim(`${scope} ${this.targetSelector}${filters}`);
Expand All @@ -37,14 +46,6 @@ class Selector {
selector = ':first';
}

deprecate(
'Usage of comma separated selectors is deprecated in ember-cli-page-object', selector.indexOf(',') === -1, {
id: 'ember-cli-page-object.comma-separated-selectors',
until: "2.0.0",
url: 'https://ember-cli-page-object.js.org/docs/v1.16.x/deprecations/#comma-separated-selectors',
}
);

return selector;
}

Expand Down
16 changes: 15 additions & 1 deletion tests/integration/deprecations/comma-separated-selector-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

import { create, text } from 'dummy/tests/page-object';
import { create, text, clickOnText } from 'dummy/tests/page-object';

import require from 'require';
if (require.has('@ember/test-helpers')) {
Expand Down Expand Up @@ -69,5 +69,19 @@ if (require.has('@ember/test-helpers')) {

assert.expectNoDeprecation();
});

test('don\'t show deprecation when the selector contains text with comma', async function(assert) {
let page = create({
clickOnButton: clickOnText('button')
});

await render(hbs`<fieldset>
<button>Lorem, Ipsum</button>
</fieldset>`);

page.clickOnButton('Lorem, Ipsum');

assert.expectNoDeprecation();
});
});
}