Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
let currentDay = TestUtils.scryRenderedDOMComponentsWithClass(c, 'calendar__day_current')[0]
// TEMP HACK
currentDay = currentDay[Object.keys(currentDay)[0]]._currentElement
const prevMonthButtonInstance = TestUtils.scryRenderedDOMComponentsWithClass(
c,
'calendar__arrow_left'
)[0]
// TEMP HACK
const prevMonthButton =
prevMonthButtonInstance[Object.keys(prevMonthButtonInstance)[0]]._currentElement
const nextMonthButtonInstance = TestUtils.scryRenderedDOMComponentsWithClass(
c,
'calendar__arrow_right'
)[0]
// TEMP HACK
const nextMonthButton =
nextMonthButtonInstance[Object.keys(nextMonthButtonInstance)[0]]._currentElement
assert.equal(currentDay.props.children, 1, 'Should be first of september')
assert.equal(prevMonthButton.props.children, '←', 'Should be left change month button')
assert.equal(nextMonthButton.props.children, '→', 'Should be right change month button')
assert.equal(c.state.month, currentMonth, 'Should be September')
TestUtils.Simulate.click(prevMonthButtonInstance)
assert.equal(c.state.month, currentMonth - 1, 'Should be August')
it("should have a button to change the view type", function(){
var elements = TestUtils.scryRenderedDOMComponentsWithClass(imageViewElement, "btn-group");
expect(elements.length).toBe(1);
});
it("renders and shows image thumbnails", function() {
var images = TestUtils.scryRenderedDOMComponentsWithClass(lightbox, 'lightbox-img-thumbnail');
expect(images.length).toEqual(imagesData.length);
expect(TestUtils.isDOMComponent(images[0]));
});
it("close container on close button click", function() {
var imagesData = Utils.generateImageArray();
var lightbox = TestUtils.renderIntoDocument(
);
var image = TestUtils.scryRenderedDOMComponentsWithClass(lightbox, 'lightbox-img-thumbnail')[0];
TestUtils.Simulate.click(image)
var closeButtonContainer = TestUtils.findRenderedDOMComponentWithClass(lightbox, 'lightbox-btn-close');
var closeButton = closeButtonContainer.children[0];
TestUtils.Simulate.click(closeButton);
var container = TestUtils.scryRenderedDOMComponentsWithClass(lightbox, 'lightbox-backdrop')
expect(container.length).toEqual(0);
});
});
it('should select the corresponding item', () => {
let p = panel(props());
let selected = TestUtils.scryRenderedDOMComponentsWithClass(p, 'cti-selected');
expect(selected.length).toBe(1);
expect(selected[0].textContent).toBe('Create new reversed thing "ra"');
});
});
it('should use the specified suggestionRenderer function', () => {
suggestions = TestUtils.scryRenderedDOMComponentsWithClass(autosuggest, 'react-autosuggest__suggestion');
expect(stripReactAttributes(suggestions[0].innerHTML)).to.equal('<span><strong>M</strong><span>ill Park</span></span>');
});
});
it('consists of many rows', ()=> {
const data = TestUtils.newPeopleTestData();
let component;
ReactTestUtils.renderIntoDocument(
<div>
component=c} dispatcher={null}
rows={data.detailRows()}
columns={data.columns()}
gridProps={data.gridProps()}/>
</div>);
const trs = ReactTestUtils.scryRenderedDOMComponentsWithClass(component, 'row');
expect(trs.length).toBe(10);
});
function findTags(i) {
return TestUtils.scryRenderedDOMComponentsWithClass(i, 'cti__tag');
}
const expectActiveSectionForNavAndSubNav = (component, path) => {
history.replace(path);
const activeSubSection = ReactTestUtils.scryRenderedDOMComponentsWithClass(component, 'sub-section-current');
expect(activeSubSection).to.have.lengthOf(1);
};
it('enters editing mode when edit icon clicked', () => {
const list = makeList(['1', '2']);
spyOn(list, 'setState');
const editIcon = scryRenderedDOMComponentsWithClass(list, 'edit-icon')[0];
Simulate.click(editIcon);
expect(list.setState).toHaveBeenCalledWith({editingIndex: 0});
});
});