summaryrefslogtreecommitdiff
path: root/spec/frontend/static_site_editor/store/getters_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/static_site_editor/store/getters_spec.js')
-rw-r--r--spec/frontend/static_site_editor/store/getters_spec.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/spec/frontend/static_site_editor/store/getters_spec.js b/spec/frontend/static_site_editor/store/getters_spec.js
index 8800216f3b0..1b482db9366 100644
--- a/spec/frontend/static_site_editor/store/getters_spec.js
+++ b/spec/frontend/static_site_editor/store/getters_spec.js
@@ -1,15 +1,29 @@
import createState from '~/static_site_editor/store/state';
-import { isContentLoaded } from '~/static_site_editor/store/getters';
+import { isContentLoaded, contentChanged } from '~/static_site_editor/store/getters';
import { sourceContent as content } from '../mock_data';
describe('Static Site Editor Store getters', () => {
describe('isContentLoaded', () => {
- it('returns true when content is not empty', () => {
- expect(isContentLoaded(createState({ content }))).toBe(true);
+ it('returns true when originalContent is not empty', () => {
+ expect(isContentLoaded(createState({ originalContent: content }))).toBe(true);
});
- it('returns false when content is empty', () => {
- expect(isContentLoaded(createState({ content: '' }))).toBe(false);
+ it('returns false when originalContent is empty', () => {
+ expect(isContentLoaded(createState({ originalContent: '' }))).toBe(false);
+ });
+ });
+
+ describe('contentChanged', () => {
+ it('returns true when content and originalContent are different', () => {
+ const state = createState({ content, originalContent: 'something else' });
+
+ expect(contentChanged(state)).toBe(true);
+ });
+
+ it('returns false when content and originalContent are the same', () => {
+ const state = createState({ content, originalContent: content });
+
+ expect(contentChanged(state)).toBe(false);
});
});
});