Skip to content

Commit

Permalink
Remove findElement(withAssert) deprecations for now (#502)
Browse files Browse the repository at this point in the history
start raising deprecation in the same release, where 
`findOne`/`findMany` was just implemented was a bit premature.

Doing it means users will immediatelly get warnings,
once they upgrade to 1.17, which is not friendly enough.

Instead of deprecation we start recommending the `find-one`
codemod, to make adopting new finders easier.
  • Loading branch information
ro0gr authored Apr 20, 2020
1 parent c2d1a6f commit 5ce77d1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 46 deletions.
6 changes: 0 additions & 6 deletions addon-test-support/extend/find-element-with-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ import { deprecate } from '@ember/application/deprecations';
* @throws Will throw an error if multiple elements are matched by selector and multiple option is not set
*/
export function findElementWithAssert(pageObjectNode, targetSelector, options = {}) {
deprecate('findElementWithAssert is deprecated, please use findOne or findMany instead', false, {
id: 'ember-cli-page-object.old-finders',
until: '2.0.0',
url: 'https://ember-cli-page-object.js.org/docs/v1.16.x/deprecations/#old-finders'
});

const shouldShowMutlipleDeprecation = 'multiple' in options;
deprecate('"multiple" property is deprecated', !shouldShowMutlipleDeprecation, {
id: 'ember-cli-page-object.multiple',
Expand Down
6 changes: 0 additions & 6 deletions addon-test-support/extend/find-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ import { deprecate } from '@ember/application/deprecations';
* @throws Will throw an error if multiple elements are matched by selector and multiple option is not set
*/
export function findElement(pageObjectNode, targetSelector, options = {}) {
deprecate('findElement is deprecated, please use findOne or findMany instead', false, {
id: 'ember-cli-page-object.old-finders',
until: '2.0.0',
url: 'https://ember-cli-page-object.js.org/docs/v1.16.x/deprecations/#old-finders'
});

const shouldShowMutlipleDeprecation = 'multiple' in options;
deprecate('"multiple" property is deprecated', !shouldShowMutlipleDeprecation, {
id: 'ember-cli-page-object.multiple',
Expand Down
32 changes: 0 additions & 32 deletions guides/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,35 +355,3 @@ test('renders component', function(assert) {
this.render(hbs`{{foo}}`);
});
```

## Old finders

**ID**: ember-cli-page-object.old-finders

**Until**: 2.0.0

Using `findElement` and `findElementWithAssert` is deprecated. Please use `findOne` or `findMany` instead.

```js
import { findOne, findMany } from 'ember-cli-page-object/extend';

export default function isDisabled(selector, options = {}) {
return {
isDescriptor: true,

get() {
return findOne(this, selector, options).disabled;
}
};
}

export default function count(selector, options = {}) {
return {
isDescriptor: true,

get() {
return findMany(this, selector, options).length;
}
};
}
```
10 changes: 8 additions & 2 deletions guides/extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ You can create custom helpers by creating `Ceibo` descriptors. (`Ceibo` is a sma

- [findOne](#findone)
- [findMany](#findmany)
- [findElementWithAssert](#findelementwithassert) **[Deprecated]**
- [findElement](#findelement) **[Deprecated]**
- [findElementWithAssert](#findelementwithassert)
- [findElement](#findelement)

## findOne

Expand Down Expand Up @@ -81,6 +81,10 @@ export default function count(selector, options = {}) {

[addon/-private/extend/find-element-with-assert.js:38-44](https://github.com/san650/ember-cli-page-object/blob/c521335ffba9955a6acaf1006ed503cbb61ba72d/addon/-private/extend/find-element-with-assert.js#L38-L44 "Source code on GitHub")

Note: in the v2 series we are going to deprecate `findElementWithAssert`. It's recommended to migrate to use `findOne` instead.

In order to ease the migration, you may find useful the [`find-one`](https://github.com/ro0gr/ember-page-object-codemod/tree/master/transforms/find-one) codemod to perform the migration.

**Parameters**

- `pageObjectNode` **Ceibo** Node of the tree
Expand Down Expand Up @@ -115,6 +119,8 @@ export default function isDisabled(selector, options = {}) {

[addon/-private/extend/find-element.js:36-42](https://github.com/san650/ember-cli-page-object/blob/c521335ffba9955a6acaf1006ed503cbb61ba72d/addon/-private/extend/find-element.js#L36-L42 "Source code on GitHub")

Note: in the v2 series we are going to deprecate `findElement`. It's recommended to migrate to use `findMany` instead.

**Parameters**

- `pageObjectNode` **Ceibo** Node of the tree
Expand Down

0 comments on commit 5ce77d1

Please sign in to comment.