rsuite
Version:
A suite of react components
38 lines (31 loc) • 1.1 kB
JavaScript
import React from 'react';
import { getDOMNode } from '@test/testUtils';
import Navbar from '../Navbar';
import Nav from '../../Nav';
describe('Navbar', () => {
it('Should render a navbar', () => {
const instance = getDOMNode(<Navbar />);
assert.include(instance.className, 'rs-navbar');
});
it('Should have a `navbar-nav` className in `nav`', () => {
const instance = getDOMNode(
<Navbar>
<Nav>1</Nav>
</Navbar>
);
assert.ok(instance.querySelector('.rs-nav.rs-navbar-nav'));
});
it('Should have a custom className', () => {
const instance = getDOMNode(<Navbar className="custom" />);
assert.include(instance.className, 'custom');
});
it('Should have a custom style', () => {
const fontSize = '12px';
const instance = getDOMNode(<Navbar style={{ fontSize }} />);
assert.equal(instance.style.fontSize, fontSize);
});
it('Should have a custom className prefix', () => {
const instance = getDOMNode(<Navbar classPrefix="custom-prefix" />);
assert.ok(instance.className.match(/\bcustom-prefix\b/));
});
});