Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const target = '_blank'
const text = 'GO'
const title = 'Example Title'
// Insert the component into DOM.
const el = T.renderIntoDocument(
<button title="{title}" href="{href}">
)
// Get button.
const button = T.findRenderedDOMComponentWithClass(el, 't7-form__button')
// ===================
// Test for existence.
// ===================
it('exists in the page', function () {
expect(T.isCompositeComponent(el)).toBe(true)
})
// =============
// Test for tag.
// =============
it('is a link tag', function () {
const x = button.tagName.toLowerCase()
</button>
describe('DataTable', function () {
// Insert the component into DOM.
const el = T.renderIntoDocument(
)
// Get parent element.
const parent = T.findRenderedDOMComponentWithClass(el, 't7-data-table__wrapper')
// Get column headers.
const thead = parent.querySelector('thead')
const th = thead.querySelectorAll('th')
// Get the rows.
const tbody = parent.querySelector('tbody')
// Get pagination.
const pagination = parent.querySelectorAll('.t7-data-table__pagination')
// ========================
// Pagination: top, bottom.
// ========================
const paginationTop = pagination[0]
it('should contain a grid', () => {
const grid = TestUtils.findRenderedDOMComponentWithClass(component, 'grid');
assert.ok(grid);
});
it('renders no facilities message if no facilities passed', () => {
var FacilityRadiosInstance = TestUtils.renderIntoDocument(
);
var message = TestUtils.findRenderedDOMComponentWithClass(FacilityRadiosInstance, 'content-padded');
expect(message.textContent).toEqual('No nearby facilities located.');
});
it('clicking pause button fires pause callback', function() {
expect(this.output.props.pause).to.not.have.been.called();
let button = TestUtils.findRenderedDOMComponentWithClass(this.output, 'pause');
TestUtils.Simulate.click(button);
expect(this.output.props.pause).to.have.been.called();
});
});
it("adds a `today` modifier to today date", () => {
const dayPickerEl = TestUtils.renderIntoDocument(
);
const today = new Date();
const todayEl = TestUtils.findRenderedDOMComponentWithClass(dayPickerEl,
"DayPicker-Day--today");
expect(ReactDOM.findDOMNode(todayEl).innerHTML).to.equal(`${today.getDate()}`);
});
const overlayClassName = 'what-what';
const overlay = renderIntoDocument(
);
const overlayContainerNode = findDOMNode(overlay);
expect(overlayContainerNode.style.display).toBe(style.display);
expect(overlayContainerNode.classList.contains(className)).toBe(true);
const overlayNode = findRenderedDOMComponentWithClass(overlay, 'md-overlay');
expect(overlayNode.style.background).toBe(overlayStyle.background);
expect(overlayNode.classList.contains(overlayClassName)).toBe(true);
});
it('calls onItemCreated', () => {
const onItemCreated = jasmine.createSpy('onItemCreated');
const list = makeList(['1', '2'], {initialState: {creatingItem: true}, onItemCreated});
const createItem = findRenderedDOMComponentWithClass(list, 'create-item-input');
const input = createItem.querySelector('input');
findDOMNode(input).value = 'New Item';
Simulate.keyDown(input, {key: 'Enter'});
expect(onItemCreated).toHaveBeenCalledWith('New Item');
});
expect(function() {
TestUtils.findRenderedDOMComponentWithClass(tree, "outlet-content");
}).toThrow();
expect(() => {
findRenderedDOMComponentWithClass(button, 'at')
}).toThrow()
});