Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-16 15:08:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-16 15:08:32 +0300
commitc158fa8d69c704663d289341a014c44c062cda88 (patch)
treed0cac82a9ac9e9ad28bb0030266eb8d5dc91fbbc /spec/frontend/ide
parentb806264d29b8d52ccb78a41dcc3d67f2b040700c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ide')
-rw-r--r--spec/frontend/ide/stores/actions/file_spec.js68
1 files changed, 52 insertions, 16 deletions
diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js
index e7b34aa3e7a..a8e48f0b85e 100644
--- a/spec/frontend/ide/stores/actions/file_spec.js
+++ b/spec/frontend/ide/stores/actions/file_spec.js
@@ -514,6 +514,8 @@ describe('IDE store file actions', () => {
describe('changeFileContent', () => {
let tmpFile;
+ const callAction = (content = 'content\n') =>
+ store.dispatch('changeFileContent', { path: tmpFile.path, content });
beforeEach(() => {
tmpFile = file('tmpFile');
@@ -523,11 +525,7 @@ describe('IDE store file actions', () => {
});
it('updates file content', done => {
- store
- .dispatch('changeFileContent', {
- path: tmpFile.path,
- content: 'content\n',
- })
+ callAction()
.then(() => {
expect(tmpFile.content).toBe('content\n');
@@ -537,11 +535,7 @@ describe('IDE store file actions', () => {
});
it('adds a newline to the end of the file if it doesnt already exist', done => {
- store
- .dispatch('changeFileContent', {
- path: tmpFile.path,
- content: 'content',
- })
+ callAction('content')
.then(() => {
expect(tmpFile.content).toBe('content\n');
@@ -551,11 +545,7 @@ describe('IDE store file actions', () => {
});
it('adds file into changedFiles array', done => {
- store
- .dispatch('changeFileContent', {
- path: tmpFile.path,
- content: 'content',
- })
+ callAction()
.then(() => {
expect(store.state.changedFiles.length).toBe(1);
@@ -564,7 +554,7 @@ describe('IDE store file actions', () => {
.catch(done.fail);
});
- it('adds file once into changedFiles array', done => {
+ it('adds file not more than once into changedFiles array', done => {
store
.dispatch('changeFileContent', {
path: tmpFile.path,
@@ -604,6 +594,52 @@ describe('IDE store file actions', () => {
.catch(done.fail);
});
+ describe('when `gon.feature.stageAllByDefault` is true', () => {
+ const originalGonFeatures = Object.assign({}, gon.features);
+
+ beforeAll(() => {
+ gon.features = { stageAllByDefault: true };
+ });
+
+ afterAll(() => {
+ gon.features = originalGonFeatures;
+ });
+
+ it('adds file into stagedFiles array', done => {
+ store
+ .dispatch('changeFileContent', {
+ path: tmpFile.path,
+ content: 'content',
+ })
+ .then(() => {
+ expect(store.state.stagedFiles.length).toBe(1);
+
+ done();
+ })
+ .catch(done.fail);
+ });
+
+ it('adds file not more than once into stagedFiles array', done => {
+ store
+ .dispatch('changeFileContent', {
+ path: tmpFile.path,
+ content: 'content',
+ })
+ .then(() =>
+ store.dispatch('changeFileContent', {
+ path: tmpFile.path,
+ content: 'content 123',
+ }),
+ )
+ .then(() => {
+ expect(store.state.stagedFiles.length).toBe(1);
+
+ done();
+ })
+ .catch(done.fail);
+ });
+ });
+
it('bursts unused seal', done => {
store
.dispatch('changeFileContent', {