import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/MultiSelectCheckbox/test/MultiSelectCheckbox.spec.jsx";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import React from 'react';
import MultiSelectCheckbox from '../MultiSelectCheckbox';
import { multiSelectCheckboxUniDriverFactory } from '../MultiSelectCheckbox.uni.driver';
import { cleanup, createRendererWithUniDriver, waitFor } from '../../utils/test-utils/react';
import { act } from '../../utils/test-utils/unit';
var asciiA = '97';
describe('multiSelectCheckbox', function () {
  describe('[async]', function () {
    runTests(createRendererWithUniDriver(multiSelectCheckboxUniDriverFactory));
  });
  function runTests(render) {
    var _this = this;
    afterEach(cleanup);
    var createDriver = function createDriver(jsx) {
      return render(jsx).driver;
    };
    var options = [{
      value: 'Alabama',
      id: 'Alabama-1'
    }, {
      value: 'Alaska',
      id: 'Alaska'
    }, {
      value: /*#__PURE__*/React.createElement("div", {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 25,
          columnNumber: 16
        }
      }, "Arkansas"),
      id: 'Arkansas',
      label: 'Arkansan Label'
    }, {
      value: 'Arkansas',
      id: 'Arkansas'
    }, {
      value: 'California',
      id: 'California'
    }, {
      value: 'California2',
      id: 'California2'
    }, {
      value: 'California3',
      id: 'California3'
    }, {
      value: 'California4',
      id: 'California4'
    }, {
      value: 'California5',
      id: 'California5'
    }, {
      value: 'California6',
      id: 'California6'
    }, {
      value: 'California7',
      id: 'California7',
      disabled: true
    }, {
      value: 'Two words',
      id: 'Two words'
    }];
    it('should not be editable by default', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
      var _createDriver, driver;
      return _regeneratorRuntime.wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            _createDriver = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 39,
                columnNumber: 9
              }
            })), driver = _createDriver.driver;
            _context.t0 = expect;
            _context.next = 4;
            return driver.isEditable();
          case 4:
            _context.t1 = _context.sent;
            (0, _context.t0)(_context.t1).toBe(false);
          case 6:
          case "end":
            return _context.stop();
        }
      }, _callee);
    })));
    it('should not be editable if the disableEditing is set to true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
      var _createDriver2, driver;
      return _regeneratorRuntime.wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            _createDriver2 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              disableEditing: true,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 46,
                columnNumber: 9
              }
            })), driver = _createDriver2.driver;
            _context2.t0 = expect;
            _context2.next = 4;
            return driver.isEditable();
          case 4:
            _context2.t1 = _context2.sent;
            (0, _context2.t0)(_context2.t1).toBe(false);
          case 6:
          case "end":
            return _context2.stop();
        }
      }, _callee2);
    })));
    it('should be editable if the disableEditing is set to false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
      var _createDriver3, driver;
      return _regeneratorRuntime.wrap(function _callee3$(_context3) {
        while (1) switch (_context3.prev = _context3.next) {
          case 0:
            _createDriver3 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              disableEditing: false,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 54,
                columnNumber: 9
              }
            })), driver = _createDriver3.driver;
            _context3.t0 = expect;
            _context3.next = 4;
            return driver.isEditable();
          case 4:
            _context3.t1 = _context3.sent;
            (0, _context3.t0)(_context3.t1).toBe(true);
          case 6:
          case "end":
            return _context3.stop();
        }
      }, _callee3);
    })));
    it('should show dropdown on input click', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
      var _createDriver4, inputDriver, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee4$(_context4) {
        while (1) switch (_context4.prev = _context4.next) {
          case 0:
            _createDriver4 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 62,
                columnNumber: 9
              }
            })), inputDriver = _createDriver4.inputDriver, dropdownLayoutDriver = _createDriver4.dropdownLayoutDriver;
            _context4.next = 3;
            return inputDriver.click();
          case 3:
            _context4.t0 = expect;
            _context4.next = 6;
            return dropdownLayoutDriver.isShown();
          case 6:
            _context4.t1 = _context4.sent;
            (0, _context4.t0)(_context4.t1).toBe(true);
          case 8:
          case "end":
            return _context4.stop();
        }
      }, _callee4);
    })));
    it('should not show dropdown on input click when disabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
      var _createDriver5, inputDriver, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee5$(_context5) {
        while (1) switch (_context5.prev = _context5.next) {
          case 0:
            _createDriver5 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              disabled: true,
              options: options,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 70,
                columnNumber: 9
              }
            })), inputDriver = _createDriver5.inputDriver, dropdownLayoutDriver = _createDriver5.dropdownLayoutDriver;
            _context5.next = 3;
            return inputDriver.click();
          case 3:
            _context5.t0 = expect;
            _context5.next = 6;
            return dropdownLayoutDriver.isShown();
          case 6:
            _context5.t1 = _context5.sent;
            (0, _context5.t0)(_context5.t1).toBe(false);
          case 8:
          case "end":
            return _context5.stop();
        }
      }, _callee5);
    })));
    it('should not show dropdown on input click [when] readOnly', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
      var _createDriver6, inputDriver, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee6$(_context6) {
        while (1) switch (_context6.prev = _context6.next) {
          case 0:
            _createDriver6 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              readOnly: true,
              options: options,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 78,
                columnNumber: 9
              }
            })), inputDriver = _createDriver6.inputDriver, dropdownLayoutDriver = _createDriver6.dropdownLayoutDriver;
            _context6.next = 3;
            return inputDriver.click();
          case 3:
            _context6.t0 = expect;
            _context6.next = 6;
            return dropdownLayoutDriver.isShown();
          case 6:
            _context6.t1 = _context6.sent;
            (0, _context6.t0)(_context6.t1).toBe(false);
          case 8:
          case "end":
            return _context6.stop();
        }
      }, _callee6);
    })));
    it('should close dropdown on second input click', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
      var _createDriver7, inputDriver, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee8$(_context8) {
        while (1) switch (_context8.prev = _context8.next) {
          case 0:
            _createDriver7 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 86,
                columnNumber: 9
              }
            })), inputDriver = _createDriver7.inputDriver, dropdownLayoutDriver = _createDriver7.dropdownLayoutDriver;
            _context8.next = 3;
            return inputDriver.click();
          case 3:
            _context8.next = 5;
            return inputDriver.click();
          case 5:
            _context8.next = 7;
            return waitFor(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
              return _regeneratorRuntime.wrap(function _callee7$(_context7) {
                while (1) switch (_context7.prev = _context7.next) {
                  case 0:
                    _context7.t0 = expect;
                    _context7.next = 3;
                    return dropdownLayoutDriver.isShown();
                  case 3:
                    _context7.t1 = _context7.sent;
                    (0, _context7.t0)(_context7.t1).toBe(false);
                  case 5:
                  case "end":
                    return _context7.stop();
                }
              }, _callee7);
            })));
          case 7:
          case "end":
            return _context8.stop();
        }
      }, _callee8);
    })));
    it('should close dropdown on Escape', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1() {
      var _createDriver8, inputDriver, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee1$(_context1) {
        while (1) switch (_context1.prev = _context1.next) {
          case 0:
            _createDriver8 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 97,
                columnNumber: 9
              }
            })), inputDriver = _createDriver8.inputDriver, dropdownLayoutDriver = _createDriver8.dropdownLayoutDriver;
            _context1.next = 3;
            return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
              return _regeneratorRuntime.wrap(function _callee9$(_context9) {
                while (1) switch (_context9.prev = _context9.next) {
                  case 0:
                    _context9.next = 2;
                    return inputDriver.click();
                  case 2:
                  case "end":
                    return _context9.stop();
                }
              }, _callee9);
            })));
          case 3:
            _context1.next = 5;
            return inputDriver.focus();
          case 5:
            _context1.next = 7;
            return inputDriver.keyDown({
              key: 'Escape'
            });
          case 7:
            _context1.next = 9;
            return waitFor(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0() {
              return _regeneratorRuntime.wrap(function _callee0$(_context0) {
                while (1) switch (_context0.prev = _context0.next) {
                  case 0:
                    _context0.t0 = expect;
                    _context0.next = 3;
                    return dropdownLayoutDriver.isShown();
                  case 3:
                    _context0.t1 = _context0.sent;
                    (0, _context0.t0)(_context0.t1).toBe(false);
                  case 5:
                  case "end":
                    return _context0.stop();
                }
              }, _callee0);
            })));
          case 9:
          case "end":
            return _context1.stop();
        }
      }, _callee1);
    })));
    var OPEN_DROPDOWN_CHARS = [{
      key: 'ArrowDown',
      keyCode: 40,
      which: 40
    }, {
      key: 'Enter',
      keyCode: 13,
      which: 13
    }, {
      key: 'Space',
      keyCode: 32,
      which: 32
    }];
    OPEN_DROPDOWN_CHARS.forEach(function (charData) {
      it("should show dropdown on input focus and press on ".concat(charData.key), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
        var _createDriver9, inputDriver, dropdownLayoutDriver;
        return _regeneratorRuntime.wrap(function _callee10$(_context10) {
          while (1) switch (_context10.prev = _context10.next) {
            case 0:
              _createDriver9 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 120,
                  columnNumber: 11
                }
              })), inputDriver = _createDriver9.inputDriver, dropdownLayoutDriver = _createDriver9.dropdownLayoutDriver;
              _context10.next = 3;
              return inputDriver.focus();
            case 3:
              _context10.next = 5;
              return inputDriver.trigger('keyDown', charData);
            case 5:
              _context10.t0 = expect;
              _context10.next = 8;
              return dropdownLayoutDriver.isShown();
            case 8:
              _context10.t1 = _context10.sent;
              (0, _context10.t0)(_context10.t1).toBe(true);
            case 10:
            case "end":
              return _context10.stop();
          }
        }, _callee10);
      })));
    });
    it('should not lose Focus or close the list on selection with a mouse click', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
      var _createDriver0, inputDriver, dropdownLayoutDriver, driver;
      return _regeneratorRuntime.wrap(function _callee11$(_context11) {
        while (1) switch (_context11.prev = _context11.next) {
          case 0:
            _createDriver0 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 131,
                columnNumber: 9
              }
            })), inputDriver = _createDriver0.inputDriver, dropdownLayoutDriver = _createDriver0.dropdownLayoutDriver, driver = _createDriver0.driver;
            _context11.next = 3;
            return inputDriver.click();
          case 3:
            _context11.next = 5;
            return driver.selectOptionById('Alabama-1');
          case 5:
            _context11.t0 = expect;
            _context11.next = 8;
            return dropdownLayoutDriver.isShown();
          case 8:
            _context11.t1 = _context11.sent;
            (0, _context11.t0)(_context11.t1).toBe(true);
            _context11.t2 = expect;
            _context11.next = 13;
            return inputDriver.isFocusedStyle();
          case 13:
            _context11.t3 = _context11.sent;
            (0, _context11.t2)(_context11.t3).toBe(true);
          case 15:
          case "end":
            return _context11.stop();
        }
      }, _callee11);
    })));
    it('should display a selectedOptions separated by default delimiter', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
      var selectedOptions, _createDriver1, inputDriver;
      return _regeneratorRuntime.wrap(function _callee12$(_context12) {
        while (1) switch (_context12.prev = _context12.next) {
          case 0:
            selectedOptions = [options[0].id, options[1].id];
            _createDriver1 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: selectedOptions,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 144,
                columnNumber: 9
              }
            })), inputDriver = _createDriver1.inputDriver;
            _context12.t0 = expect;
            _context12.next = 5;
            return inputDriver.getValue();
          case 5:
            _context12.t1 = _context12.sent;
            (0, _context12.t0)(_context12.t1).toBe("".concat(options[0].value, ", ").concat(options[1].value));
          case 7:
          case "end":
            return _context12.stop();
        }
      }, _callee12);
    })));
    it('should display a selectedOptions separated by custom delimiter', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
      var selectedOptions, delimiter, _createDriver10, inputDriver;
      return _regeneratorRuntime.wrap(function _callee13$(_context13) {
        while (1) switch (_context13.prev = _context13.next) {
          case 0:
            selectedOptions = [options[0].id, options[1].id];
            delimiter = ';';
            _createDriver10 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: selectedOptions,
              delimiter: delimiter,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 158,
                columnNumber: 9
              }
            })), inputDriver = _createDriver10.inputDriver;
            _context13.t0 = expect;
            _context13.next = 6;
            return inputDriver.getValue();
          case 6:
            _context13.t1 = _context13.sent;
            (0, _context13.t0)(_context13.t1).toBe("".concat(options[0].value, ";").concat(options[1].value));
          case 8:
          case "end":
            return _context13.stop();
        }
      }, _callee13);
    })));
    it('should not display the selectedOptions that not included in options', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
      var selectedOptions, _createDriver11, inputDriver;
      return _regeneratorRuntime.wrap(function _callee14$(_context14) {
        while (1) switch (_context14.prev = _context14.next) {
          case 0:
            selectedOptions = [options[0].id, 'NOT_LEGAL_ID', options[1].id];
            _createDriver11 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: selectedOptions,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 172,
                columnNumber: 9
              }
            })), inputDriver = _createDriver11.inputDriver;
            _context14.t0 = expect;
            _context14.next = 5;
            return inputDriver.getValue();
          case 5:
            _context14.t1 = _context14.sent;
            (0, _context14.t0)(_context14.t1).toBe("".concat(options[0].value, ", ").concat(options[1].value));
          case 7:
          case "end":
            return _context14.stop();
        }
      }, _callee14);
    })));
    it('should display value passed as prop (controlled input)', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
      var selectedOptions, value, _createDriver12, inputDriver;
      return _regeneratorRuntime.wrap(function _callee15$(_context15) {
        while (1) switch (_context15.prev = _context15.next) {
          case 0:
            selectedOptions = [options[0].id, options[1].id];
            value = 'Controlled input value';
            _createDriver12 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: selectedOptions,
              value: value,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 186,
                columnNumber: 9
              }
            })), inputDriver = _createDriver12.inputDriver;
            _context15.t0 = expect;
            _context15.next = 6;
            return inputDriver.getValue();
          case 6:
            _context15.t1 = _context15.sent;
            (0, _context15.t0)(_context15.t1).toBe(value);
          case 8:
          case "end":
            return _context15.stop();
        }
      }, _callee15);
    })));
    describe('valueParser', function () {
      it('should use the default valueParser', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
        var options, selectedOptions, _createDriver13, driver;
        return _regeneratorRuntime.wrap(function _callee16$(_context16) {
          while (1) switch (_context16.prev = _context16.next) {
            case 0:
              options = [{
                value: 'Option 1',
                id: 'Option 1'
              }];
              selectedOptions = [options[0].id];
              _createDriver13 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                selectedOptions: selectedOptions,
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 202,
                  columnNumber: 11
                }
              })), driver = _createDriver13.driver;
              _context16.t0 = expect;
              _context16.next = 6;
              return driver.getLabelAt(0);
            case 6:
              _context16.t1 = _context16.sent;
              (0, _context16.t0)(_context16.t1).toBe(options[0].value);
            case 8:
            case "end":
              return _context16.stop();
          }
        }, _callee16);
      })));
      it('should use the default valueParser for options that contain label property', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
        var options, selectedOptions, _createDriver14, driver;
        return _regeneratorRuntime.wrap(function _callee17$(_context17) {
          while (1) switch (_context17.prev = _context17.next) {
            case 0:
              options = [{
                value: /*#__PURE__*/React.createElement("div", {
                  __self: _this,
                  __source: {
                    fileName: _jsxFileName,
                    lineNumber: 214,
                    columnNumber: 20
                  }
                }, "Option 1"),
                id: 'Option 1',
                label: 'Option 1 Label'
              }];
              selectedOptions = [options[0].id];
              _createDriver14 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                selectedOptions: selectedOptions,
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 223,
                  columnNumber: 11
                }
              })), driver = _createDriver14.driver;
              _context17.t0 = expect;
              _context17.next = 6;
              return driver.getLabelAt(0);
            case 6:
              _context17.t1 = _context17.sent;
              (0, _context17.t0)(_context17.t1).toBe(options[0].label);
            case 8:
            case "end":
              return _context17.stop();
          }
        }, _callee17);
      })));
      it('should use provided valueParser when given', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
        var specialOption, selectedOptions, options, valueParser, _createDriver15, driver;
        return _regeneratorRuntime.wrap(function _callee18$(_context18) {
          while (1) switch (_context18.prev = _context18.next) {
            case 0:
              specialOption = {
                value: 'Arkansas',
                id: 'Arkansas',
                customOptionPropertyByTheUser: 'Arkansan Label'
              };
              selectedOptions = [specialOption.id];
              options = [specialOption];
              valueParser = function valueParser(option) {
                return option.customOptionPropertyByTheUser;
              };
              _createDriver15 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                valueParser: valueParser,
                options: options,
                selectedOptions: selectedOptions,
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 244,
                  columnNumber: 11
                }
              })), driver = _createDriver15.driver;
              _context18.t0 = expect;
              _context18.next = 8;
              return driver.getLabelAt(0);
            case 8:
              _context18.t1 = _context18.sent;
              (0, _context18.t0)(_context18.t1).toBe(specialOption.customOptionPropertyByTheUser);
            case 10:
            case "end":
              return _context18.stop();
          }
        }, _callee18);
      })));
    });
    it('should allow using functions as options', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
      var options, _createDriver16, inputDriver, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee19$(_context19) {
        while (1) switch (_context19.prev = _context19.next) {
          case 0:
            options = [{
              value: vi.fn(),
              id: 'option1',
              label: 'option 1'
            }, {
              value: vi.fn(),
              id: 'option2',
              label: 'option 2'
            }];
            _createDriver16 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: [options[0].id],
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 271,
                columnNumber: 9
              }
            })), inputDriver = _createDriver16.inputDriver, dropdownLayoutDriver = _createDriver16.dropdownLayoutDriver;
            _context19.next = 4;
            return inputDriver.click();
          case 4:
            _context19.t0 = expect;
            _context19.next = 7;
            return dropdownLayoutDriver.isShown();
          case 7:
            _context19.t1 = _context19.sent;
            (0, _context19.t0)(_context19.t1).toBe(true);
            expect(options[0].value).toHaveBeenCalledWith({
              selected: true,
              disabled: undefined,
              hovered: false
            });
            expect(options[1].value).toHaveBeenCalledWith({
              selected: false,
              disabled: undefined,
              hovered: false
            });
          case 11:
          case "end":
            return _context19.stop();
        }
      }, _callee19);
    })));
    it('should contain specific selected values', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {
      var selectedOptions, _createDriver17, driver;
      return _regeneratorRuntime.wrap(function _callee20$(_context20) {
        while (1) switch (_context20.prev = _context20.next) {
          case 0:
            selectedOptions = [options[0].id, options[1].id];
            _createDriver17 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: selectedOptions,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 296,
                columnNumber: 9
              }
            })), driver = _createDriver17.driver;
            _context20.t0 = expect;
            _context20.next = 5;
            return driver.getNumOfLabels();
          case 5:
            _context20.t1 = _context20.sent;
            (0, _context20.t0)(_context20.t1).toBe(selectedOptions.length);
            _context20.t2 = expect;
            _context20.next = 10;
            return driver.getLabelAt(0);
          case 10:
            _context20.t3 = _context20.sent;
            (0, _context20.t2)(_context20.t3).toBe(options[0].value);
            _context20.t4 = expect;
            _context20.next = 15;
            return driver.getLabelAt(1);
          case 15:
            _context20.t5 = _context20.sent;
            (0, _context20.t4)(_context20.t5).toBe(options[1].value);
          case 17:
          case "end":
            return _context20.stop();
        }
      }, _callee20);
    })));
    it('should not close dropdown after clicking on an option', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
      var _createDriver18, inputDriver, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee21$(_context21) {
        while (1) switch (_context21.prev = _context21.next) {
          case 0:
            _createDriver18 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 308,
                columnNumber: 9
              }
            })), inputDriver = _createDriver18.inputDriver, dropdownLayoutDriver = _createDriver18.dropdownLayoutDriver;
            _context21.next = 3;
            return inputDriver.click();
          case 3:
            _context21.next = 5;
            return dropdownLayoutDriver.clickAtOption(0);
          case 5:
            _context21.t0 = expect;
            _context21.next = 8;
            return dropdownLayoutDriver.isShown();
          case 8:
            _context21.t1 = _context21.sent;
            (0, _context21.t0)(_context21.t1).toBe(true);
          case 10:
          case "end":
            return _context21.stop();
        }
      }, _callee21);
    })));
    it('should call onSelect when selecting unselected option', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
      var onSelect, _createDriver19, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee22$(_context22) {
        while (1) switch (_context22.prev = _context22.next) {
          case 0:
            onSelect = vi.fn();
            _createDriver19 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              onSelect: onSelect,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 318,
                columnNumber: 9
              }
            })), dropdownLayoutDriver = _createDriver19.dropdownLayoutDriver;
            _context22.next = 4;
            return dropdownLayoutDriver.clickAtOption(0);
          case 4:
            expect(onSelect.mock.calls).toHaveLength(1);
            expect(onSelect).toHaveBeenCalledWith(options[0].id, options[0]);
          case 6:
          case "end":
            return _context22.stop();
        }
      }, _callee22);
    })));
    it('should not call onSelect when selecting a disabled option', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
      var onSelect, indexOfDisabled, _createDriver20, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee23$(_context23) {
        while (1) switch (_context23.prev = _context23.next) {
          case 0:
            onSelect = vi.fn();
            indexOfDisabled = options.findIndex(function (opt) {
              return opt.disabled;
            });
            _createDriver20 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              onSelect: onSelect,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 329,
                columnNumber: 9
              }
            })), dropdownLayoutDriver = _createDriver20.dropdownLayoutDriver;
            _context23.next = 5;
            return dropdownLayoutDriver.clickAtOption(indexOfDisabled);
          case 5:
            expect(onSelect).not.toHaveBeenCalled();
          case 6:
          case "end":
            return _context23.stop();
        }
      }, _callee23);
    })));
    it('should call onDeselect when selecting selected option', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee24() {
      var selectedOptions, onDeselect, _createDriver21, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee24$(_context24) {
        while (1) switch (_context24.prev = _context24.next) {
          case 0:
            selectedOptions = [options[0].id, options[1].id];
            onDeselect = vi.fn();
            _createDriver21 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: selectedOptions,
              onDeselect: onDeselect,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 339,
                columnNumber: 9
              }
            })), dropdownLayoutDriver = _createDriver21.dropdownLayoutDriver;
            _context24.next = 5;
            return dropdownLayoutDriver.clickAtOption(0);
          case 5:
            expect(onDeselect).toHaveBeenCalledWith(options[0].id, options[0]);
          case 6:
          case "end":
            return _context24.stop();
        }
      }, _callee24);
    })));
    it('should getLabels', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee25() {
      var selectedOptions, onDeselect, _createDriver22, driver;
      return _regeneratorRuntime.wrap(function _callee25$(_context25) {
        while (1) switch (_context25.prev = _context25.next) {
          case 0:
            selectedOptions = [options[0].id, options[1].id];
            onDeselect = vi.fn();
            _createDriver22 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: selectedOptions,
              onDeselect: onDeselect,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 353,
                columnNumber: 9
              }
            })), driver = _createDriver22.driver;
            _context25.t0 = expect;
            _context25.next = 6;
            return driver.getLabels();
          case 6:
            _context25.t1 = _context25.sent;
            (0, _context25.t0)(_context25.t1).toEqual([options[0].value, options[1].value]);
          case 8:
          case "end":
            return _context25.stop();
        }
      }, _callee25);
    })));
    it('should getLabels with delimiter', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {
      var selectedOptions, onDeselect, delimiter, _createDriver23, driver;
      return _regeneratorRuntime.wrap(function _callee26$(_context26) {
        while (1) switch (_context26.prev = _context26.next) {
          case 0:
            selectedOptions = [options[0].id, options[1].id];
            onDeselect = vi.fn();
            delimiter = '.';
            _createDriver23 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: selectedOptions,
              onDeselect: onDeselect,
              delimiter: delimiter,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 371,
                columnNumber: 9
              }
            })), driver = _createDriver23.driver;
            _context26.t0 = expect;
            _context26.next = 7;
            return driver.getLabels(delimiter);
          case 7:
            _context26.t1 = _context26.sent;
            (0, _context26.t0)(_context26.t1).toEqual([options[0].value, options[1].value]);
          case 9:
          case "end":
            return _context26.stop();
        }
      }, _callee26);
    })));
    it('should getLabelAt with delimiter', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
      var selectedOptions, onDeselect, delimiter, _createDriver24, driver;
      return _regeneratorRuntime.wrap(function _callee27$(_context27) {
        while (1) switch (_context27.prev = _context27.next) {
          case 0:
            selectedOptions = [options[0].id, options[1].id];
            onDeselect = vi.fn();
            delimiter = '.';
            _createDriver24 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              selectedOptions: selectedOptions,
              onDeselect: onDeselect,
              delimiter: delimiter,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 391,
                columnNumber: 9
              }
            })), driver = _createDriver24.driver;
            _context27.t0 = expect;
            _context27.next = 7;
            return driver.getLabelAt(1, delimiter);
          case 7:
            _context27.t1 = _context27.sent;
            (0, _context27.t0)(_context27.t1).toEqual(selectedOptions[1]);
          case 9:
          case "end":
            return _context27.stop();
        }
      }, _callee27);
    })));
    it('opens dropdown on space key press', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
      var onChange, _createDriver25, inputDriver, dropdownLayoutDriver;
      return _regeneratorRuntime.wrap(function _callee28$(_context28) {
        while (1) switch (_context28.prev = _context28.next) {
          case 0:
            onChange = vi.fn();
            _createDriver25 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
              options: options,
              onChange: onChange,
              value: "W",
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 405,
                columnNumber: 9
              }
            })), inputDriver = _createDriver25.inputDriver, dropdownLayoutDriver = _createDriver25.dropdownLayoutDriver;
            _context28.next = 4;
            return inputDriver.click();
          case 4:
            _context28.next = 6;
            return inputDriver.enterText(' ');
          case 6:
            expect(onChange).toHaveBeenCalledTimes(0);
            _context28.t0 = expect;
            _context28.next = 10;
            return dropdownLayoutDriver.isShown();
          case 10:
            _context28.t1 = _context28.sent;
            (0, _context28.t0)(_context28.t1).toBe(true);
          case 12:
          case "end":
            return _context28.stop();
        }
      }, _callee28);
    })));
    describe('enableSearch', function () {
      it('should render custom value', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {
        var value, _createDriver26, inputDriver;
        return _regeneratorRuntime.wrap(function _callee29$(_context29) {
          while (1) switch (_context29.prev = _context29.next) {
            case 0:
              value = 'custom value';
              _createDriver26 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                value: value,
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 419,
                  columnNumber: 11
                }
              })), inputDriver = _createDriver26.inputDriver;
              _context29.t0 = expect;
              _context29.next = 5;
              return inputDriver.getValue();
            case 5:
              _context29.t1 = _context29.sent;
              (0, _context29.t0)(_context29.t1).toBe(value);
            case 7:
            case "end":
              return _context29.stop();
          }
        }, _callee29);
      })));
      it('should render placeholder', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee30() {
        var placeholder, _createDriver27, inputDriver;
        return _regeneratorRuntime.wrap(function _callee30$(_context30) {
          while (1) switch (_context30.prev = _context30.next) {
            case 0:
              placeholder = 'custom placeholder';
              _createDriver27 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                placeholder: placeholder,
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 428,
                  columnNumber: 11
                }
              })), inputDriver = _createDriver27.inputDriver;
              _context30.t0 = expect;
              _context30.next = 5;
              return inputDriver.getPlaceholder();
            case 5:
              _context30.t1 = _context30.sent;
              (0, _context30.t0)(_context30.t1).toBe(placeholder);
            case 7:
            case "end":
              return _context30.stop();
          }
        }, _callee30);
      })));
      it('should filter items according when enableSearch is enabled', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
        var searchTerm, options, _createDriver28, inputDriver, dropdownLayoutDriver;
        return _regeneratorRuntime.wrap(function _callee31$(_context31) {
          while (1) switch (_context31.prev = _context31.next) {
            case 0:
              searchTerm = 'Wix';
              options = [{
                value: 'Wix',
                id: 'Wix'
              }, {
                value: 'Blah',
                id: 'Blah'
              }, {
                value: 'Wix Blah',
                id: 'Wix Blah'
              }, {
                value: 'Something else',
                id: 'Something else'
              }];
              _createDriver28 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                enableSearch: true,
                value: "",
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 443,
                  columnNumber: 11
                }
              })), inputDriver = _createDriver28.inputDriver, dropdownLayoutDriver = _createDriver28.dropdownLayoutDriver;
              _context31.next = 5;
              return inputDriver.enterText(searchTerm);
            case 5:
              _context31.next = 7;
              return inputDriver.trigger('keyDown', {
                key: asciiA
              });
            case 7:
              _context31.t0 = expect;
              _context31.next = 10;
              return dropdownLayoutDriver.optionsLength();
            case 10:
              _context31.t1 = _context31.sent;
              (0, _context31.t0)(_context31.t1).toBe(options.length);
            case 12:
            case "end":
              return _context31.stop();
          }
        }, _callee31);
      })));
      it('should display empty state message in case all options are filtered', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee32() {
        var emptyStateMessage, _createDriver29, inputDriver, dropdownLayoutDriver;
        return _regeneratorRuntime.wrap(function _callee32$(_context32) {
          while (1) switch (_context32.prev = _context32.next) {
            case 0:
              emptyStateMessage = 'Empty state';
              _createDriver29 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                predicate: function predicate() {
                  return false;
                },
                enableSearch: true,
                value: "",
                emptyStateMessage: emptyStateMessage,
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 454,
                  columnNumber: 11
                }
              })), inputDriver = _createDriver29.inputDriver, dropdownLayoutDriver = _createDriver29.dropdownLayoutDriver;
              _context32.next = 4;
              return inputDriver.click();
            case 4:
              _context32.next = 6;
              return inputDriver.enterText('a');
            case 6:
              _context32.next = 8;
              return inputDriver.trigger('keyDown', {
                key: asciiA
              });
            case 8:
              _context32.t0 = expect;
              _context32.next = 11;
              return dropdownLayoutDriver.isShown();
            case 11:
              _context32.t1 = _context32.sent;
              (0, _context32.t0)(_context32.t1).toBe(true);
              _context32.t2 = expect;
              _context32.next = 16;
              return dropdownLayoutDriver.optionsLength();
            case 16:
              _context32.t3 = _context32.sent;
              (0, _context32.t2)(_context32.t3).toBe(1);
            case 18:
            case "end":
              return _context32.stop();
          }
        }, _callee32);
      })));
      it('should filter items according to predicate', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee33() {
        var searchTerm, predicate, options, _createDriver30, inputDriver, dropdownLayoutDriver;
        return _regeneratorRuntime.wrap(function _callee33$(_context33) {
          while (1) switch (_context33.prev = _context33.next) {
            case 0:
              searchTerm = 'Wix';
              predicate = function predicate(option) {
                return option.value.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1;
              };
              options = [{
                value: 'Wix',
                id: 'Wix'
              }, {
                value: 'Blah',
                id: 'Blah'
              }, {
                value: 'Wix Blah',
                id: 'Wix Blah'
              }, {
                value: 'Something else',
                id: 'Something else'
              }];
              _createDriver30 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                enableSearch: true,
                predicate: predicate,
                value: "",
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 482,
                  columnNumber: 11
                }
              })), inputDriver = _createDriver30.inputDriver, dropdownLayoutDriver = _createDriver30.dropdownLayoutDriver;
              _context33.next = 6;
              return inputDriver.enterText(searchTerm);
            case 6:
              _context33.next = 8;
              return inputDriver.trigger('keyDown', {
                key: asciiA
              });
            case 8:
              _context33.t0 = expect;
              _context33.next = 11;
              return dropdownLayoutDriver.optionsLength();
            case 11:
              _context33.t1 = _context33.sent;
              (0, _context33.t0)(_context33.t1).toBe(2);
            case 13:
            case "end":
              return _context33.stop();
          }
        }, _callee33);
      })));
      it('should display custom selected options text', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee34() {
        var getSelectedOptionsText, selectedOptions, _createDriver31, inputDriver;
        return _regeneratorRuntime.wrap(function _callee34$(_context34) {
          while (1) switch (_context34.prev = _context34.next) {
            case 0:
              getSelectedOptionsText = function getSelectedOptionsText(selectedOptionsCount) {
                return "Selected ".concat(selectedOptionsCount, " options");
              };
              selectedOptions = [options[0].id, options[1].id];
              _createDriver31 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                selectedOptions: selectedOptions,
                enableSearch: true,
                value: "",
                getSelectedOptionsText: getSelectedOptionsText,
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 500,
                  columnNumber: 11
                }
              })), inputDriver = _createDriver31.inputDriver;
              _context34.t0 = expect;
              _context34.next = 6;
              return inputDriver.getValue();
            case 6:
              _context34.t1 = _context34.sent;
              (0, _context34.t0)(_context34.t1).toBe(getSelectedOptionsText(selectedOptions.length));
            case 8:
            case "end":
              return _context34.stop();
          }
        }, _callee34);
      })));
      it('calls onChange when space is pressed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee35() {
        var onChange, _createDriver32, inputDriver, dropdownLayoutDriver;
        return _regeneratorRuntime.wrap(function _callee35$(_context35) {
          while (1) switch (_context35.prev = _context35.next) {
            case 0:
              onChange = vi.fn();
              _createDriver32 = createDriver(/*#__PURE__*/React.createElement(MultiSelectCheckbox, {
                options: options,
                onChange: onChange,
                enableSearch: true,
                value: "W",
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 516,
                  columnNumber: 11
                }
              })), inputDriver = _createDriver32.inputDriver, dropdownLayoutDriver = _createDriver32.dropdownLayoutDriver;
              _context35.next = 4;
              return inputDriver.focus();
            case 4:
              _context35.next = 6;
              return inputDriver.enterText(' ');
            case 6:
              expect(onChange).toHaveBeenCalledTimes(1);
              _context35.t0 = expect;
              _context35.next = 10;
              return dropdownLayoutDriver.isShown();
            case 10:
              _context35.t1 = _context35.sent;
              (0, _context35.t0)(_context35.t1).toBe(false);
            case 12:
            case "end":
              return _context35.stop();
          }
        }, _callee35);
      })));
    });
  }
});