rx-page-objects
Advanced tools
Comparing version 1.29.0 to 1.30.0
@@ -1176,2 +1176,70 @@ /*jshint node:true*/ | ||
var rxTags = require('./index').rxTags; | ||
/** | ||
rxTags exercises. | ||
@exports encore.exercise.rxTags | ||
@param {Object} [options=] - Test options. Used to build valid tests. | ||
@param {rxTags} [options.instance=] - Component to Exercise. | ||
@param {string} options.sampleText - A tag that can be added. | ||
@example | ||
```js | ||
describe('default exercises', encore.exercise.rxTags({ | ||
instance: encore.rxTags.initialize('.demo rx-tags') // select one of many widgets on page | ||
})); | ||
``` | ||
*/ | ||
exports.rxTags = function (options) { | ||
if (options === undefined) { | ||
options = {}; | ||
} | ||
options = _.defaults(options, { | ||
sampleText: undefined | ||
}); | ||
return function () { | ||
var component, tag, numTags; | ||
before(function () { | ||
if (options.instance !== undefined) { | ||
component = options.instance; | ||
} else { | ||
component = rxTags.main; | ||
} | ||
component.count().then(function (num) { | ||
numTags = num; | ||
}); | ||
}); | ||
if (!_.isUndefined(options.sampleText)) { | ||
it('adds a tag', function () { | ||
tag = component.addTag(options.sampleText); | ||
expect(tag.text).to.eventually.equal(options.sampleText); | ||
expect(component.count()).to.eventually.equal(numTags + 1); | ||
}); | ||
it('removes a tag by clicking the x', function () { | ||
tag.remove(); | ||
expect(tag.exists()).to.eventually.be.false; | ||
expect(component.count()).to.eventually.equal(numTags); | ||
}); | ||
it('focuses the last tag by typing backspace', function () { | ||
tag = component.addTag(options.sampleText); | ||
expect(tag.isFocused()).to.eventually.be.false; | ||
component.sendBackspace(); | ||
expect(tag.isFocused()).to.eventually.be.true; | ||
}); | ||
it('removes a focused tag by entering a backspace', function () { | ||
tag.sendBackspace(); | ||
expect(component.byText(options.sampleText).exists()).to.eventually.be.false; | ||
expect(component.count()).to.eventually.equal(numTags); | ||
}); | ||
} | ||
}; | ||
}; | ||
var rxToggleSwitch = require('./index').rxToggleSwitch; | ||
@@ -1178,0 +1246,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "Midway test page objects for all of the Encore UI components", | ||
"version": "1.29.0", | ||
"version": "1.30.0", | ||
"main": "index.js", | ||
@@ -14,3 +14,4 @@ "license": "Apache License, Version 2.0", | ||
"moment": "2.8.2", | ||
"lodash": "2.4.1" | ||
"lodash": "2.4.1", | ||
"node-timing.js": "1.1.0" | ||
}, | ||
@@ -17,0 +18,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
379026
5805
3
+ Addednode-timing.js@1.1.0
+ Addednode-timing.js@1.1.0(transitive)