summaryrefslogtreecommitdiff
path: root/spec/javascripts/ide/stores/actions
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-07 12:06:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-07 12:06:21 +0000
commit84a0e65ac88c7a3db86a0e4347606ba093490bef (patch)
tree860de954548b509e92f6f95a66c8c75cf389efb0 /spec/javascripts/ide/stores/actions
parentbf3d94a7332ff411b654137a1d1288c399fceba4 (diff)
downloadgitlab-ce-84a0e65ac88c7a3db86a0e4347606ba093490bef.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/ide/stores/actions')
-rw-r--r--spec/javascripts/ide/stores/actions/file_spec.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/spec/javascripts/ide/stores/actions/file_spec.js b/spec/javascripts/ide/stores/actions/file_spec.js
index 021c3076094..472128ad834 100644
--- a/spec/javascripts/ide/stores/actions/file_spec.js
+++ b/spec/javascripts/ide/stores/actions/file_spec.js
@@ -455,6 +455,8 @@ describe('IDE store file actions', () => {
beforeEach(() => {
tmpFile = file('tmpFile');
+ tmpFile.content = '\n';
+ tmpFile.raw = '\n';
store.state.entries[tmpFile.path] = tmpFile;
});
@@ -462,10 +464,24 @@ describe('IDE store file actions', () => {
store
.dispatch('changeFileContent', {
path: tmpFile.path,
+ content: 'content\n',
+ })
+ .then(() => {
+ expect(tmpFile.content).toBe('content\n');
+
+ done();
+ })
+ .catch(done.fail);
+ });
+
+ it('adds a newline to the end of the file if it doesnt already exist', done => {
+ store
+ .dispatch('changeFileContent', {
+ path: tmpFile.path,
content: 'content',
})
.then(() => {
- expect(tmpFile.content).toBe('content');
+ expect(tmpFile.content).toBe('content\n');
done();
})
@@ -510,12 +526,12 @@ describe('IDE store file actions', () => {
store
.dispatch('changeFileContent', {
path: tmpFile.path,
- content: 'content',
+ content: 'content\n',
})
.then(() =>
store.dispatch('changeFileContent', {
path: tmpFile.path,
- content: '',
+ content: '\n',
}),
)
.then(() => {