-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implements #463
- Loading branch information
Showing
24 changed files
with
586 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { getExecutionContext } from '../-private/execution_context'; | ||
import { filterWhitelistedOption } from '../-private/helpers'; | ||
/** | ||
* @public | ||
* | ||
* Returns array of elements | ||
* | ||
* @example | ||
* | ||
* import { findMany } from '../extend'; | ||
* | ||
* export default function count(selector, options = {}) { | ||
* return { | ||
* isDescriptor: true, | ||
* | ||
* get() { | ||
* return findMany(this, selector, options).length; | ||
* } | ||
* }; | ||
* } | ||
* | ||
* @param {Ceibo} pageObjectNode - Node of the tree | ||
* @param {string} targetSelector - Specific CSS selector | ||
* @param {Object} options - Additional options | ||
* @param {boolean} options.resetScope - Do not use inherited scope | ||
* @param {string} options.contains - Filter by using :contains('foo') pseudo-class | ||
* @param {string} options.scope | ||
* @param {number} options.at - Filter by index using :eq(x) pseudo-class | ||
* @param {boolean} options.last - Filter by using :last pseudo-class | ||
* @param {boolean} options.visible - Filter by using :visible pseudo-class | ||
* @param {string} options.testContainer - Context where to search elements in the DOM | ||
* @return {Array} of Element | ||
*/ | ||
export function findMany(pageObjectNode, targetSelector, options = {}) { | ||
const filteredOptions = filterWhitelistedOption(options, [ | ||
'resetScope', 'visible', 'testContainer', 'contains', 'scope', 'at', 'last' | ||
]); | ||
const opts = Object.assign({}, filteredOptions, { multiple: true }); | ||
return getExecutionContext(pageObjectNode).find(targetSelector, opts).get(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { getExecutionContext } from '../-private/execution_context'; | ||
import { filterWhitelistedOption } from "../-private/helpers"; | ||
|
||
/** | ||
* @public | ||
* | ||
* Returns a element | ||
* | ||
* @example | ||
* | ||
* import { findOne } from 'ember-cli-page-object'; | ||
* | ||
* export default function isDisabled(selector, options = {}) { | ||
* return { | ||
* isDescriptor: true, | ||
* | ||
* get() { | ||
* return findOne(this, selector, options).disabled; | ||
* } | ||
* }; | ||
* } | ||
* | ||
* @param {Ceibo} pageObjectNode - Node of the tree | ||
* @param {string} targetSelector - Specific CSS selector | ||
* @param {Object} options - Additional options | ||
* @param {boolean} options.resetScope - Do not use inherited scope | ||
* @param {string} options.contains - Filter by using :contains('foo') pseudo-class | ||
* @param {string} options.scope | ||
* @param {number} options.at - Filter by index using :eq(x) pseudo-class | ||
* @param {boolean} options.last - Filter by using :last pseudo-class | ||
* @param {boolean} options.visible - Filter by using :visible pseudo-class | ||
* @param {string} options.testContainer - Context where to search elements in the DOM | ||
* @param {string} options.pageObjectKey - Used in the error message when the element is not found | ||
* @return {Element} | ||
* | ||
* @throws If no elements found | ||
* @throws If more than one element found | ||
*/ | ||
export function findOne(pageObjectNode, targetSelector, options = {}) { | ||
const filteredOptions = filterWhitelistedOption(options, [ | ||
'resetScope', 'visible', 'testContainer', 'contains', 'at', 'last', 'scope', 'pageObjectKey' | ||
]); | ||
const opts = Object.assign({}, filteredOptions, { multiple: false }); | ||
return getExecutionContext(pageObjectNode).findWithAssert(targetSelector, opts).get(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.