Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var legend = TestUtils.renderIntoDocument(
);
var legendWithTitle = TestUtils.renderIntoDocument(
);
// Verify there is no heading element
var noTitleHeadings = TestUtils.scryRenderedDOMComponentsWithTag(
legend, 'h4');
expect(noTitleHeadings).to.have.length(0);
// Verify there is a heading element
var titleHeadings = TestUtils.scryRenderedDOMComponentsWithTag(
legendWithTitle, 'h4');
expect(titleHeadings).to.have.length(1);
});
});
it('should render children', () => {
instance = createTweenGroupInstance();
children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'p');
expect(children.length).to.be(1);
});
it("renders the artist information", () => {
const inquiries = TestUtils.renderIntoDocument() as Inquiries
const aTags = TestUtils.scryRenderedDOMComponentsWithTag(inquiries, "a") as HTMLAnchorElement[]
const artistLink = aTags.find(tag => tag.href === "/percy-z" && tag.textContent === "Percy Z")
expect(artistLink).toBeTruthy()
const noConvoLink = aTags.find(tag => tag.href === "/percy-z-without-conversation")
expect(noConvoLink).toBeUndefined()
})
ticker.timeout(() => {
let child = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'i');
console.log('child opacity:', getFloat(child[0].style.opacity));
expect(getFloat(child[0].style.opacity)).to.above(0.99);
cDom.scrollTop = 0;
console.log('scrollTop:', cDom.scrollTop);
ticker.timeout(() => {
child = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'i');
console.log('always = false, child opacity:', child[0].style.opacity);
expect(getFloat(child[0].style.opacity)).to.be(1);
done();
}, 350);
}, 350);
}, 35);
it('should display the message prop', () => {
const props = {message: 'Test Message', id: 'foo-id'};
const component = renderStatelessComponent(Error, props);
const spans = TestUtils.scryRenderedDOMComponentsWithTag(component, 'span');
const element = findElementById(spans, props.id);
expect(element.id).to.equal(props.id);
expect(element.textContent).to.equal(props.message);
});
it('should display a generic message if none is passed', () => {
defaultProps.ref.impl = function (page) {
defaultProps.ref.impl = undefined;
const selects = ReactTestUtils.scryRenderedDOMComponentsWithTag(page.els.filters, 'select');
const limitField = selects.filter((select) => {
return select.name === 'limit';
})[0];
ReactTestUtils.Simulate.change(limitField, {
target: {
name: 'limit',
value: '10'
}
});
};
function allTag(comp, tagName) {
return TestUtils.scryRenderedDOMComponentsWithTag(comp, tagName);
}
it('renders a visible field', () => {
let input = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'input')[0];
expect(input.type).toEqual('text');
});
it('renders a parent div with a pod CSS class', () => {
let radioButtonNode = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div')[0];
expect(radioButtonNode.classList[0]).toEqual('carbon-radio-button');
});
it('returns the the correct markup', () => {
let header = (
foo
);
instance = TestUtils.renderIntoDocument(
<table path="/test">
</table>
);
let parent = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'thead')[0];
expect(parent).toBeDefined();
expect(instance.thead).toEqual(
{header}
)
});
});