wix-style-react
Version:
wix-style-react
67 lines (53 loc) • 2.61 kB
JavaScript
var _this = this;
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
import { multiSelectCheckboxTestkitFactory } from '../../testkit/protractor';
import { waitForVisibilityOf } from 'wix-ui-test-utils/protractor';
import { getStoryUrl } from '../../test/utils/storybook-helpers';
import eyes from 'eyes.it';
describe('MultiSelectCheckbox', function () {
var storyUrl = getStoryUrl('4. Selection', '4.1 + MultiSelectCheckbox');
var driver = multiSelectCheckboxTestkitFactory({
dataHook: 'multi-select-checkbox'
});
beforeEach(function () {
browser.get(storyUrl);
});
eyes.it('should update the input with selected values when select multiple check box in drop down', _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return waitForVisibilityOf(driver.element(), 'Cannot find <MultiSelectCheckbox/>');
case 2:
driver.clickInput();
driver.selectItemById('Arkansas');
driver.selectItemById('California');
expect(driver.getInput().getAttribute('value')).toBe('Arkansas, California');
case 6:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
})));
eyes.it('should open or close drop down when clicking on the input', _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return waitForVisibilityOf(driver.element(), 'Cannot find <MultiSelectCheckbox/>');
case 2:
driver.clickInput();
expect(driver.getDropdown().isDisplayed()).toBe(true);
driver.clickInput();
expect(driver.getDropdown().isDisplayed()).toBe(false);
case 6:
case 'end':
return _context2.stop();
}
}
}, _callee2, _this);
})));
});