UNPKG

enzyme-page-object

Version:

A library to help write enzyme tests using the page-object pattern

34 lines (22 loc) 1.05 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Page = require('./Page'); var _Page2 = _interopRequireDefault(_Page); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Section = function Section(_ref) { var page = _ref.page, type = _ref.type, component = _ref.component, options = _objectWithoutProperties(_ref, ['page', 'type', 'component']); _classCallCheck(this, Section); var context = page; if (typeof page === 'undefined') { context = new _Page2.default(type, component, options); } this.context = context; }; exports.default = Section;