rx-page-objects
Advanced tools
Comparing version 1.22.0 to 1.23.0
@@ -319,6 +319,10 @@ /*jshint node:true*/ | ||
@param {string} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
@param {String} title - The title of the rxCollapse element. | ||
@param {Boolean} expanded - Whether or not the rxCollapse element is currently expanded. | ||
@example | ||
```js | ||
describe('default exercises', encore.exercise.rxCollapse({ | ||
cssSelector: '.secondary-info rx-paginate', // select one of many widgets on page | ||
cssSelector: '.secondary-info rx-collapse', // select one of many widgets on page | ||
title: 'My Custom rxCollapse Element', | ||
expanded: true | ||
})); | ||
@@ -332,3 +336,6 @@ ``` | ||
options = _.defaults(options, { /* defaults go here */ }); | ||
options = _.defaults(options, { | ||
title: undefined, | ||
expanded: false, | ||
}); | ||
@@ -350,18 +357,30 @@ return function () { | ||
it('should show a custom title', function () { | ||
expect(component.title.getText()).to.eventually.equal('A Custom Title'); | ||
}); | ||
it('should expand and collapse with toggle', function () { | ||
expect(component.isExpanded).to.eventually.be.true; | ||
expect(component.isExpanded()).to.eventually.eq(options.expanded); | ||
// Collapse | ||
component.btnToggle.click(); | ||
expect(component.isExpanded).to.eventually.be.false; | ||
component.toggle(); | ||
expect(component.isExpanded()).to.eventually.eq(!options.expanded); | ||
// Expand | ||
component.btnToggle.click(); | ||
expect(component.isExpanded).to.eventually.be.true; | ||
component.toggle(); | ||
expect(component.isExpanded()).to.eventually.eq(options.expanded); | ||
}); | ||
if (!_.isUndefined(options.title)) { | ||
it('should show a custom title', function () { | ||
expect(component.title).to.eventually.equal(options.title); | ||
}); | ||
} else { | ||
it('should show "See More" for the title', function () { | ||
expect(component.title).to.eventually.equal('See More'); | ||
}); | ||
it('should toggle between "See More" and "See Less"', function () { | ||
component.toggle(); | ||
expect(component.title).to.eventually.equal('See Less'); | ||
component.toggle(); | ||
expect(component.title).to.eventually.equal('See More'); | ||
}); | ||
} | ||
}; | ||
@@ -368,0 +387,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"description": "Midway test page objects for all of the Encore UI components", | ||
"version": "1.22.0", | ||
"version": "1.23.0", | ||
"main": "index.js", | ||
@@ -8,0 +8,0 @@ "license": "Apache License, Version 2.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
320165
5121