Update tests for EntryEditorToolbar
This commit is contained in:
@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
|
|||||||
import EntryEditorToolbar from '../EntryEditorToolbar';
|
import EntryEditorToolbar from '../EntryEditorToolbar';
|
||||||
|
|
||||||
describe('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(
|
const component = shallow(
|
||||||
<EntryEditorToolbar
|
<EntryEditorToolbar
|
||||||
onPersist={() => {}}
|
onPersist={() => {}}
|
||||||
@ -15,6 +15,19 @@ describe('EntryEditorToolbar', () => {
|
|||||||
expect(tree).toMatchSnapshot();
|
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', () => {
|
it('should disable and update label of Save button when persisting', () => {
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<EntryEditorToolbar
|
<EntryEditorToolbar
|
||||||
|
@ -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 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>"`;
|
||||||
|
Reference in New Issue
Block a user