Update tests for EntryEditorToolbar

This commit is contained in:
Caleb 2017-09-11 14:25:23 -06:00
parent 87f942e73b
commit 6e356e81da
2 changed files with 17 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import EntryEditorToolbar from '../EntryEditorToolbar';
describe('EntryEditorToolbar', () => {
it('should have both buttons enabled initially', () => {
it('should have the Save button disabled initally, and the Cancel button enabled', () => {
const component = shallow(
<EntryEditorToolbar
onPersist={() => {}}
@ -15,6 +15,19 @@ describe('EntryEditorToolbar', () => {
expect(tree).toMatchSnapshot();
});
it('should enable the Save button', () => {
const component = shallow(
<EntryEditorToolbar
enableSave
onPersist={() => {}}
onCancelEdit={() => {}}
onDelete={() => {}}
/>
);
const tree = component.html();
expect(tree).toMatchSnapshot();
});
it('should disable and update label of Save button when persisting', () => {
const component = shallow(
<EntryEditorToolbar

View File

@ -2,4 +2,6 @@
exports[`EntryEditorToolbar should disable and update label of Save button when persisting 1`] = `"<div><button disabled=\\"\\" class=\\"\\" type=\\"button\\" data-react-toolbox=\\"button\\">Saving...</button> <button class=\\"\\" type=\\"button\\" data-react-toolbox=\\"button\\">Cancel</button></div>"`;
exports[`EntryEditorToolbar should have both buttons enabled initially 1`] = `"<div><button class=\\"\\" type=\\"button\\" data-react-toolbox=\\"button\\">Save</button> <button class=\\"\\" type=\\"button\\" data-react-toolbox=\\"button\\">Cancel</button></div>"`;
exports[`EntryEditorToolbar should enable the Save button 1`] = `"<div><button class=\\"\\" type=\\"button\\" data-react-toolbox=\\"button\\">Save</button> <button class=\\"\\" type=\\"button\\" data-react-toolbox=\\"button\\">Cancel</button></div>"`;
exports[`EntryEditorToolbar should have the Save button disabled initally, and the Cancel button enabled 1`] = `"<div><button disabled=\\"\\" class=\\"\\" type=\\"button\\" data-react-toolbox=\\"button\\">Save</button> <button class=\\"\\" type=\\"button\\" data-react-toolbox=\\"button\\">Cancel</button></div>"`;