rx-page-objects
Advanced tools
Comparing version 1.27.0 to 1.28.0
209
exercise.js
@@ -9,7 +9,8 @@ /*jshint node:true*/ | ||
@param {Object} [options=] - Test options. Used to build valid tests. | ||
@param {string} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
@param {rxBulkSelect} [options.instance=] - Component to exercise. | ||
@param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
@example | ||
```js | ||
describe('default exercises', encore.exercise.rxBulkSelect({ | ||
cssSelector: 'table.servers[rx-bulk-select]' // select one of many widgets on page | ||
instance: myPage.bulkSelect // select one of many widgets from your page objects | ||
})); | ||
@@ -29,5 +30,10 @@ ``` | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} else { | ||
component = rxBulkSelect.main; | ||
} else { | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxBulkSelect.initialize($(options.cssSelector)); | ||
@@ -100,3 +106,4 @@ } | ||
@param {Object} [options=] - Test options. Used to build valid tests. | ||
@param {string} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
@param {rxCharacterCount} [options.instance=] - Component to exercise. | ||
@param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
@param {Number} [options.maxCharacters=254] - The total number of characters allowed. | ||
@@ -110,3 +117,3 @@ @param {Number} [options.nearLimit=10] - The number of remaining characters needed to trigger the "near-limit" class. | ||
describe('default exercises', encore.exercise.rxCharacterCount({ | ||
cssSelector: '.demo-custom-max-characters', // select one of many widgets on page | ||
instance: myPage.submission // select one of many widgets from your page objects | ||
maxCharacters: 25, | ||
@@ -134,5 +141,10 @@ nearLimit: 12, | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} else { | ||
component = rxCharacterCount.main; | ||
} else { | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxCharacterCount.initialize($(options.cssSelector)); | ||
@@ -262,3 +274,4 @@ } | ||
* @param {Object} [options=] - Test options. Used to build valid tests. | ||
* @param {String} [options.cssSelector=] - Fallback selector string with which to initialize widget. | ||
* @param {rxCheckbox} [options.instance=] - Component to exercise. | ||
* @param {String} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
* @param {Boolean} [options.disabled=false] - Determines if the checkbox is disabled | ||
@@ -285,5 +298,8 @@ * @param {Boolean} [options.selected=false] - Determines if the checkbox is selected | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
component = rxCheckbox.main; | ||
} else { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxCheckbox.initialize($(options.cssSelector)); | ||
@@ -351,3 +367,4 @@ } | ||
@param {Object} [options=] - Test options. Used to build valid tests. | ||
@param {string} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
@param {rxCollapse} [options.instance=] - Component to exercise. | ||
@param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
@param {String} title - The title of the rxCollapse element. | ||
@@ -358,3 +375,3 @@ @param {Boolean} expanded - Whether or not the rxCollapse element is currently expanded. | ||
describe('default exercises', encore.exercise.rxCollapse({ | ||
cssSelector: '.secondary-info rx-collapse', // select one of many widgets on page | ||
instance: myPage.hiddenSection, // select one of many widgets from your page objects | ||
title: 'My Custom rxCollapse Element', | ||
@@ -379,5 +396,10 @@ expanded: true | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} else { | ||
component = rxCollapse.main; | ||
} else { | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxCollapse.initialize($(options.cssSelector)); | ||
@@ -391,10 +413,30 @@ } | ||
it('should expand and collapse with toggle', function () { | ||
expect(component.isExpanded()).to.eventually.eq(options.expanded); | ||
it('should expand', function () { | ||
component.expand(); | ||
expect(component.isCollapsed()).to.eventually.be.false; | ||
expect(component.isExpanded()).to.eventually.be.true; | ||
}); | ||
component.toggle(); | ||
expect(component.isExpanded()).to.eventually.eq(!options.expanded); | ||
it('should not expand again', function () { | ||
component.expand(); | ||
expect(component.isCollapsed()).to.eventually.be.false; | ||
expect(component.isExpanded()).to.eventually.be.true; | ||
}); | ||
it('should collapse', function () { | ||
component.collapse(); | ||
expect(component.isCollapsed()).to.eventually.be.true; | ||
expect(component.isExpanded()).to.eventually.be.false; | ||
}); | ||
it('should not collapse again', function () { | ||
component.collapse(); | ||
expect(component.isCollapsed()).to.eventually.be.true; | ||
expect(component.isExpanded()).to.eventually.be.false; | ||
}); | ||
it('should toggle', function () { | ||
component.toggle(); | ||
expect(component.isExpanded()).to.eventually.eq(options.expanded); | ||
expect(component.isCollapsed()).to.eventually.be.false; | ||
expect(component.isExpanded()).to.eventually.be.true; | ||
}); | ||
@@ -408,2 +450,3 @@ | ||
it('should show "See More" for the title', function () { | ||
component.collapse(); | ||
expect(component.title).to.eventually.equal('See More'); | ||
@@ -413,6 +456,8 @@ }); | ||
it('should toggle between "See More" and "See Less"', function () { | ||
component.toggle(); | ||
component.expand(); | ||
expect(component.title).to.eventually.equal('See Less'); | ||
}); | ||
component.toggle(); | ||
it('should toggle between "See Less" and "See More"', function () { | ||
component.collapse(); | ||
expect(component.title).to.eventually.equal('See More'); | ||
@@ -422,2 +467,7 @@ }); | ||
after(function () { | ||
// put it back according to the options | ||
options.expanded ? component.expand() : component.collapse(); | ||
}); | ||
}; | ||
@@ -433,3 +483,4 @@ }; | ||
* @param {Object} [options=] - Test options. Used to build valid tests. | ||
* @param {string} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
* @param {rxFieldName} [options.instance=] - Component to exercise. | ||
* @param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
* @param {string} [options.visible=true] - Determines if the field name is visible | ||
@@ -454,5 +505,8 @@ * @param {string} [options.present=true] - Determines if the field name is present in the DOM | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
component = rxForm.fieldName.main; | ||
} else { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxForm.fieldName.initialize($(options.cssSelector)); | ||
@@ -471,3 +525,3 @@ } | ||
it('symbol should be present', function () { | ||
it('should have a symbol present', function () { | ||
expect(component.isSymbolPresent()).to.eventually.be.true; | ||
@@ -480,3 +534,3 @@ }); | ||
it('symbol should not be present', function () { | ||
it('should not have a symbol present', function () { | ||
expect(component.isSymbolPresent()).to.eventually.be.false; | ||
@@ -487,7 +541,7 @@ }); | ||
if (options.required === true) { | ||
it('symbol should be visible', function () { | ||
it('should have a symbol visible', function () { | ||
expect(component.isSymbolVisible()).to.eventually.be.true; | ||
}); | ||
} else { | ||
it('symbol should not be visible', function () { | ||
it('should not have a symbol visible', function () { | ||
expect(component.isSymbolVisible()).to.eventually.be.false; | ||
@@ -593,3 +647,4 @@ }); | ||
* @param {Object} [options=] - Test options. Used to build valid tests. | ||
* @param {string} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
* @param {rxOptionTable} [options.instance=] - Component to exercise. | ||
* @param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
* @param {string} [options.visible=true] - Determines if the option table is visible | ||
@@ -612,5 +667,10 @@ * @param {string} [options.empty=false] - Determines if the option table is empty | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} else { | ||
component = rxOptionTable.main; | ||
} else { | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxOptionTable.initialize($(options.cssSelector)); | ||
@@ -651,3 +711,4 @@ } | ||
@param {Object} [options=] - Test options. Used to build valid tests. | ||
@param {string} [options.cssSelector=] - Fallback selector string to initialize pagination widget with. | ||
@param {rxPaginate} [options.instance=] - Component to exercise. | ||
@param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
@param {string} [options.pages=6] - Estimated page size in the pagination widget. | ||
@@ -660,3 +721,3 @@ @param {number[]} [options.pageSizes=50, 200, 350, 500] - Page sizes to validate. | ||
describe('default exercises', encore.exercise.rxPaginate({ | ||
cssSelector: '.secondary-info rx-paginate', // select one of many pagination tables | ||
instance: myPage.pagination, // select one of many pagination instances from your page objects | ||
pages: 20 // will exercise full functionality at 6, limited functionality at 2 | ||
@@ -682,5 +743,10 @@ })); | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
if (options.instance !== undefined) { | ||
pagination = options.instance; | ||
} else { | ||
pagination = rxPaginate.main; | ||
} else { | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
pagination = rxPaginate.initialize($(options.cssSelector)); | ||
@@ -830,3 +896,4 @@ } | ||
* @param {Object} [options=] - Test options. Used to build valid tests. | ||
* @param {String} [options.cssSelector=] - Fallback selector string with which to initialize widget. | ||
* @param {rxRadio} [options.instance=] - Component to exercise. | ||
* @param {String} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
* @param {Boolean} [options.disabled=false] - Determines if the radio is disabled. | ||
@@ -853,5 +920,8 @@ * @param {Boolean} [options.selected=false] - Determines if the radio is selected. | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
component = rxRadio.main; | ||
} else { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxRadio.initialize($(options.cssSelector)); | ||
@@ -893,3 +963,4 @@ } | ||
@param {Object} [options=] - Test options. Used to build valid tests. | ||
@param {string} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
@param {rxSearchBox} [options.instance=] - Component to exercise. | ||
@param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
@param {boolean} [options.disabled=false] - Determines if the search box is disabled | ||
@@ -900,3 +971,3 @@ @param {string} [options.placeholder='Search...'] - Expected placeholder value | ||
describe('default exercises', encore.exercise.rxSearchBox({ | ||
cssSelector: '.secondary-info rx-search-box', // select one of many widgets on page | ||
instance: myPage.searchText, // select one of many widgets from your page objects | ||
})); | ||
@@ -919,5 +990,10 @@ ``` | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} else { | ||
component = rxSearchBox.main; | ||
} else { | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxSearchBox.initialize($(options.cssSelector)); | ||
@@ -981,3 +1057,4 @@ } | ||
* @param {Object} [options=] - Test options. Used to build valid tests. | ||
* @param {String} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
* @param {rxSelect} [options.instance=] - Component to exercise. | ||
* @param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
* @param {Boolean} [options.disabled=false] - Determines if the select is disabled | ||
@@ -1003,5 +1080,8 @@ * @param {Boolean} [options.visible=true] - Determines if the select is visible | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
component = rxSelect.main; | ||
} else { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxSelect.initialize($(options.cssSelector)); | ||
@@ -1041,3 +1121,4 @@ } | ||
@param {Object} [options=] - Test options. Used to build valid tests. | ||
@param {string} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
@param {rxMultiSelect} [options.instance=] - Component to exercise. | ||
@param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
@param {Object} [options.inputs=[]] - The options of the select input. | ||
@@ -1047,3 +1128,3 @@ @example | ||
describe('default exercises', encore.exercise.rxMultiSelect({ | ||
cssSelector: '.my-form rx-multi-select', // select one of many widgets on page | ||
instance: myPage.subscriptionList, // select one of many widgets from your page objects | ||
})); | ||
@@ -1065,5 +1146,10 @@ ``` | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} else { | ||
component = rxMultiSelect.main; | ||
} else { | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxMultiSelect.initialize($(options.cssSelector)); | ||
@@ -1130,3 +1216,4 @@ } | ||
@param {Object} [options] - Test options. Used to build valid tests. | ||
@param {string} [options.cssSelector] - Fallback selector string to initialize widget with. | ||
@param {rxToggleSwitch} [options.instance=] - Component to exercise. | ||
@param {string} [options.cssSelector=] - DEPRECATED: Fallback selector string to initialize widget with. | ||
@param {boolean} [options.disabled=false] - Determines if the switch can be toggled | ||
@@ -1136,3 +1223,3 @@ @example | ||
describe('default exercises', encore.exercise.rxToggleSwitch({ | ||
cssSelector: '.demo-defualt-values' // select one of many widgets on page | ||
cssSelector: myPage.emailPreference // select one of many widgets from your page objects | ||
})); | ||
@@ -1165,7 +1252,13 @@ ``` | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} else { | ||
component = rxToggleSwitch.main; | ||
} else { | ||
} | ||
if (options.cssSelector !== undefined) { | ||
console.warn('Deprecated exercise option `cssSelector` will be removed in favor of `instance`'); | ||
component = rxToggleSwitch.initialize($(options.cssSelector)); | ||
} | ||
component.isEnabled().then(function (isEnabled) { | ||
@@ -1172,0 +1265,0 @@ initialState = isEnabled; |
@@ -5,3 +5,3 @@ { | ||
"description": "Midway test page objects for all of the Encore UI components", | ||
"version": "1.27.0", | ||
"version": "1.28.0", | ||
"main": "index.js", | ||
@@ -8,0 +8,0 @@ "license": "Apache License, Version 2.0", |
@@ -199,2 +199,3 @@ # rx-page-objects | ||
describe('pagination', encore.exercise.rxPaginate({ | ||
instance: somePageObject.pagination, | ||
pageSizes: [3, 50, 200, 350, 500], | ||
@@ -201,0 +202,0 @@ defaultPageSize: 3 |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
366625
5564
229