rsuite
Version:
A suite of react components
31 lines (24 loc) • 1.11 kB
JavaScript
import React from 'react';
import { findDOMNode } from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import View from '../View';
describe('Calendar-View', () => {
it('Should render a div with "view" class', () => {
const instance = ReactTestUtils.renderIntoDocument(<View />);
assert.equal(findDOMNode(instance).nodeName, 'DIV');
assert.ok(findDOMNode(instance).className.match(/\bview\b/));
});
it('Should have a custom className', () => {
const instance = ReactTestUtils.renderIntoDocument(<View className="custom" />);
assert.ok(findDOMNode(instance).className.match(/\bcustom\b/));
});
it('Should have a custom style', () => {
const fontSize = '12px';
const instance = ReactTestUtils.renderIntoDocument(<View style={{ fontSize }} />);
assert.equal(findDOMNode(instance).style.fontSize, fontSize);
});
it('Should have a custom className prefix', () => {
const instance = ReactTestUtils.renderIntoDocument(<View classPrefix="custom-prefix" />);
assert.ok(findDOMNode(instance).className.match(/\bcustom-prefix\b/));
});
});