mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
fix(ui): add tests for CenteredMessage
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<CenteredMessage /> matches snapshot 1`] = `
|
||||
"
|
||||
<h1 class=\\"display-1 text-placeholder screen-center\\">
|
||||
<div>
|
||||
Foo
|
||||
</div>
|
||||
</h1>
|
||||
"
|
||||
`;
|
||||
41
ui/src/Components/CenteredMessage/index.test.js
Normal file
41
ui/src/Components/CenteredMessage/index.test.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import React from "react";
|
||||
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
import toDiffableHtml from "diffable-html";
|
||||
|
||||
import { CenteredMessage } from ".";
|
||||
|
||||
describe("<CenteredMessage />", () => {
|
||||
const Message = () => <div>Foo</div>;
|
||||
|
||||
it("matches snapshot", () => {
|
||||
const tree = shallow(
|
||||
<CenteredMessage>
|
||||
<Message />
|
||||
</CenteredMessage>
|
||||
);
|
||||
expect(toDiffableHtml(tree.html())).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("uses 'display-1 text-placeholder' className by default", () => {
|
||||
const tree = shallow(
|
||||
<CenteredMessage>
|
||||
<Message />
|
||||
</CenteredMessage>
|
||||
);
|
||||
expect(toDiffableHtml(tree.html())).toMatch(/display-1 text-placeholder/);
|
||||
});
|
||||
|
||||
it("uses custom className if passed", () => {
|
||||
const tree = shallow(
|
||||
<CenteredMessage className="bar-class">
|
||||
<Message />
|
||||
</CenteredMessage>
|
||||
);
|
||||
expect(toDiffableHtml(tree.html())).toMatch(/bar-class/);
|
||||
expect(toDiffableHtml(tree.html())).not.toMatch(
|
||||
/display-1 text-placeholder/
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user