diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-09 18:09:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-09 18:09:29 +0300 |
commit | 209bd8cf1f542f6ba2a069b368a9187faa871e96 (patch) | |
tree | 6b77dc8183135b8316cc70c8dbc9c4e7c18cf05a /spec/frontend/static_site_editor/store/getters_spec.js | |
parent | a9ced7da447785c57477b3d8dbccc73a78cface1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/static_site_editor/store/getters_spec.js')
-rw-r--r-- | spec/frontend/static_site_editor/store/getters_spec.js | 24 |
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); }); }); }); |