Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ReactWrapper.prototype.ref = function () {
const ref = arguments[0]
const instance = this.instance()
// eslint-disable-next-line no-prototype-builtins
if (instance.hasOwnProperty(ref)) {
return new ReactWrapper(instance[ref], true)
} else {
return originalRef.apply(this, arguments)
}
}
ReactWrapper.prototype.ref = function () {
const ref = arguments[0]
const instance = this.instance()
// eslint-disable-next-line no-prototype-builtins
if (instance.hasOwnProperty(ref)) {
return new ReactWrapper(instance[ref], true)
} else if (typeof originalRef === 'function') {
return originalRef.apply(this, arguments)
}
}
it('support disabled time with min', () => {
const now = setTime(new Date(), TIME);
const wrapper = mount();
wrapper.find('.picker-input').simulate('click');
const pop = new ReactWrapper(wrapper.instance().picker, true);
pop.find('DatePanel .panel__cell--current').simulate('click');
pop
.find('TimePanel .time__number')
.first()
.simulate('click');
expect(
pop
.find('HourPanel .panel__cell')
.at(HOURS - 1)
.hasClass('panel__cell--disabled')
).toBe(true);
pop
.find('HourPanel .panel__cell')
it('MonthPicker has 2 level panel', () => {
let pop;
const wrapper = mount();
const inst = wrapper.instance();
expect(inst.state.openPanel).toBe(false);
expect(inst.state.showPlaceholder).toBe(true);
wrapper.find('.picker-input').simulate('click');
expect(inst.state.openPanel).toBe(true);
pop = new ReactWrapper(inst.picker, true);
expect(pop.find('MonthPanel').length).toBe(1);
expect(pop.find('.grid-cell').length).toBe(12);
const click = new Event('click');
document.dispatchEvent(click);
expect(inst.state.openPanel).toBe(false);
expect(wrapper.find('ClosablePortal').prop('visible')).toBe(false);
wrapper.find('.picker-input').simulate('click');
pop.find('.panel__title').simulate('click');
expect(pop.find('YearPanel').length).toBe(1);
expect(pop.find('YearPanel .grid-cell').length).toBe(12);
pop
.find('YearPanel .panel__cell')
.at(1)
function test_constructor() {
let anyWrapper: ReactWrapper;
anyWrapper = new ReactWrapper();
reactWrapper = new ReactWrapper();
reactWrapper = new ReactWrapper([, ]);
reactWrapper = new ReactWrapper(, reactWrapper);
reactWrapper = new ReactWrapper(, undefined, { attachTo: document.createElement('div') });
reactWrapper = new ReactWrapper(, reactWrapper, { attachTo: document.createElement('div') });
}
function test_constructor() {
let anyWrapper: ReactWrapper;
anyWrapper = new ReactWrapper();
reactWrapper = new ReactWrapper();
reactWrapper = new ReactWrapper([, ]);
reactWrapper = new ReactWrapper(, reactWrapper);
reactWrapper = new ReactWrapper(, undefined, { attachTo: document.createElement('div') });
reactWrapper = new ReactWrapper(, reactWrapper, { attachTo: document.createElement('div') });
}
function test_constructor() {
let anyWrapper: ReactWrapper;
anyWrapper = new ReactWrapper();
reactWrapper = new ReactWrapper();
reactWrapper = new ReactWrapper([, ]);
reactWrapper = new ReactWrapper(, reactWrapper);
reactWrapper = new ReactWrapper(, undefined, { attachTo: document.createElement('div') });
reactWrapper = new ReactWrapper(, reactWrapper, { attachTo: document.createElement('div') });
}
function test_constructor() {
let anyWrapper: ReactWrapper;
anyWrapper = new ReactWrapper();
reactWrapper = new ReactWrapper();
reactWrapper = new ReactWrapper([, ]);
reactWrapper = new ReactWrapper(, reactWrapper);
reactWrapper = new ReactWrapper(, undefined, { attachTo: document.createElement('div') });
reactWrapper = new ReactWrapper(, reactWrapper, { attachTo: document.createElement('div') });
}
it('should render a wrapper around the children', () => {
const children = <h1>Hello</h1>;
const wrapper = shallow({children});
const child = new ReactWrapper(wrapper.props().children('entered'));
assert.strictEqual(child.childAt(0).is('div'), true, 'should be a div');
assert.strictEqual(
child
.childAt(0)
.childAt(0)
.children()
.type(),
'h1',
'should wrap the children',
);
});
mount: (node, options) => new ReactWrapper(node, null, {
...options,
adapter: new Adapter15()
})
};