Skip to content

Commit

Permalink
Do not warn when selecting a text with comma (san650#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
veelenga authored and ro0gr committed Feb 7, 2021
1 parent 680946b commit 56684da
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
17 changes: 9 additions & 8 deletions addon-test-support/-private/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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 = `${scope} ${this.targetSelector}${filters}`.trim();
Expand All @@ -36,14 +45,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 '../../helpers';
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();
});
});
}

0 comments on commit 56684da

Please sign in to comment.