rx-page-objects
Advanced tools
Comparing version 1.18.1 to 1.19.0
@@ -278,3 +278,70 @@ /*jshint node:true*/ | ||
var rxFieldName = require('./index').rxFieldName; | ||
/** | ||
* rxFieldName exercises. | ||
* @exports encore.exercise.rxFieldName | ||
* @param {Object} [options=] - Test options. Used to build valid tests. | ||
* @param {string} [options.cssSelector=] - Fallback selector string to initialize widget with. | ||
* @param {string} [options.visible=true] - Determines if the field name is visible | ||
* @param {string} [options.present=true] - Determines if the field name is present in the DOM | ||
* @param {string} [options.required=false] - Determines if the field name displays as required | ||
*/ | ||
exports.rxFieldName = function (options) { | ||
if (options === undefined) { | ||
options = {}; | ||
} | ||
options = _.defaults(options, { | ||
visible: true, | ||
present: true, | ||
required: false | ||
}); | ||
return function () { | ||
var component; | ||
before(function () { | ||
if (options.cssSelector === undefined) { | ||
component = rxFieldName.main; | ||
} else { | ||
component = rxFieldName.initialize($(options.cssSelector)); | ||
} | ||
}); | ||
it('should ' + (options.visible ? 'be' : 'not be') + ' visible', function () { | ||
expect(component.isDisplayed()).to.eventually.eq(options.visible); | ||
}); | ||
if (options.present === true) { | ||
it('should be present', function () { | ||
expect(component.isPresent()).to.eventually.be.true; | ||
}); | ||
it('symbol should be present', function () { | ||
expect(component.isSymbolPresent()).to.eventually.be.true; | ||
}); | ||
} else { | ||
it('should not be present', function () { | ||
expect(component.isPresent()).to.eventually.be.false; | ||
}); | ||
it('symbol should not be present', function () { | ||
expect(component.isSymbolPresent()).to.eventually.be.false; | ||
}); | ||
} | ||
if (options.required === true) { | ||
it('symbol should be visible', function () { | ||
expect(component.isSymbolVisible()).to.eventually.be.true; | ||
}); | ||
} else { | ||
it('symbol should not be visible', function () { | ||
expect(component.isSymbolVisible()).to.eventually.be.false; | ||
}); | ||
} | ||
}; | ||
}; | ||
var rxPaginate = require('./index').rxPaginate; | ||
@@ -698,3 +765,3 @@ | ||
it('selects no options', function () { | ||
component.unselect(['Select All']); | ||
component.deselect(['Select All']); | ||
expect(component.selectedOptions).to.eventually.be.empty; | ||
@@ -726,4 +793,4 @@ expect(component.preview).to.eventually.equal('None'); | ||
it('unselects all options', function () { | ||
component.unselect(['Select All']); | ||
it('deselects all options', function () { | ||
component.deselect(['Select All']); | ||
expect(component.selectedOptions).to.eventually.be.empty; | ||
@@ -730,0 +797,0 @@ expect(component.preview).to.eventually.equal('None'); |
@@ -5,3 +5,3 @@ { | ||
"description": "Midway test page objects for all of the Encore UI components", | ||
"version": "1.18.1", | ||
"version": "1.19.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
299736
4821