Skip to content

Commit

Permalink
feat: on 1st generator prompt change 'back' to 'start over' (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomer-epstein authored Nov 18, 2020
1 parent d2b9383 commit a4ecb74
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 22 deletions.
39 changes: 19 additions & 20 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yeoman-ui",
"version": "1.1.37",
"version": "1.1.38",
"displayName": "Application Wizard",
"publisher": "SAPOS",
"author": {
Expand Down Expand Up @@ -203,25 +203,24 @@
"webpack-cli": "3.3.12",
"lcov-result-merger": "3.1.0",
"coveralls": "2.11.16",
"cz-conventional-changelog": "3.3.0",
"@commitlint/cli": "11.0.0",
"@commitlint/config-conventional": "11.0.0",
"husky": "4.3.0"
"cz-conventional-changelog": "3.3.0",
"@commitlint/cli": "11.0.0",
"@commitlint/config-conventional": "11.0.0",
"husky": "4.3.0"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
}
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
}
}

10 changes: 9 additions & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
v-show="promptIndex > 0"
style="min-width: 90px"
>
<v-icon left>mdi-chevron-left</v-icon>Back
<v-icon left>mdi-chevron-left</v-icon>{{ backButtonText }}
</v-btn>
<v-btn
id="next"
Expand Down Expand Up @@ -193,13 +193,21 @@ export default {
return initialState();
},
computed: {
backButtonText() {
if (this.promptIndex === 1) {
return "Start Over";
}
return "Back";
},
nextButtonText() {
if (
(this.promptIndex > 0 &&
this.promptIndex === _.size(this.promptsInfoToDisplay)) ||
this.isWriting
) {
return "Finish";
} else if (this.promptIndex === 0) {
return "Start";
}
return "Next";
Expand Down
18 changes: 17 additions & 1 deletion frontend/tests/App.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,28 @@ describe('App.vue', () => {
})
})

describe('backButtonText - computed', () => {
it('promptIndex is 1', () => {
wrapper = initComponent(App, {})
wrapper.vm.promptsInfoToDisplay = [{}, {}, {}]
wrapper.vm.promptIndex = 1
expect(wrapper.vm.backButtonText).toEqual("Start Over");
})

it('promptIndex is 3', () => {
wrapper = initComponent(App, {})
wrapper.vm.promptsInfoToDisplay = [{}, {}, {}]
wrapper.vm.promptIndex = 3
expect(wrapper.vm.backButtonText).toEqual("Back");
})
})

describe('nextButtonText - computed', () => {
it('promptIndex is 0', () => {
wrapper = initComponent(App, {})
wrapper.vm.promptsInfoToDisplay = [{}, {}, {}]
wrapper.vm.promptIndex = 0
expect(wrapper.vm.nextButtonText).toEqual("Next");
expect(wrapper.vm.nextButtonText).toEqual("Start");
})

it('promptIndex is 1', () => {
Expand Down

0 comments on commit a4ecb74

Please sign in to comment.