Skip to content

Commit

Permalink
Header - prettyName (#111)
Browse files Browse the repository at this point in the history
* Header - prettyName

* update test
  • Loading branch information
tomer-epstein authored Jan 16, 2020
1 parent 5858d34 commit f8a23bf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "Apache 2.0",
"description": "Provide rich user experience for Yeoman generators using VSCode extension or the browser",
"repository": "https://github.com/SAP/yeoman-ui",
"version": "0.0.25",
"version": "0.0.26",
"engines": {
"vscode": "^1.38.0"
},
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export default {
data() {
return {
generatorName: "",
generatorPrettyName: "",
stepValidated: false,
prompts: [],
promptIndex: 0,
Expand All @@ -127,7 +128,7 @@ export default {
);
},
selectedGeneratorHeader() {
return this.messages.selected_generator + this.generatorName;
return this.generatorName ? this.messages.selected_generator + this.generatorPrettyName : "";
},
currentPrompt() {
const prompt = _.get(this.prompts, "[" + this.promptIndex +"]")
Expand Down Expand Up @@ -275,8 +276,9 @@ export default {
this.prompts[this.promptIndex].active = true;
this.transitionToggle = !this.transitionToggle;
},
selectGenerator(generatorName) {
selectGenerator(generatorName, generatorPrettyName) {
this.generatorName = generatorName;
this.generatorPrettyName = generatorPrettyName;
},
onStepValidated(stepValidated) {
this.stepValidated = stepValidated;
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/QuestionTypes/GeneratorSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<v-card-text>
{{item.message}}
<br />
<a :href="item.homepage">Generator Documentation</a>
<a :href="item.homepage">More Information</a>
</v-card-text>
<v-spacer></v-spacer>
<v-card-actions>
Expand Down Expand Up @@ -76,7 +76,9 @@ export default {
},
emitSelection(generatorName) {
this.currentQuestion.answer = generatorName;
this.selectGenerator(generatorName);
const choice = _.find(this.currentQuestion.choices, choice => {return choice.name === generatorName});
const generatorPrettyName = _.get(choice, "prettyName", generatorName);
this.selectGenerator(generatorName, generatorPrettyName);
}
}
};
Expand Down
3 changes: 2 additions & 1 deletion frontend/tests/App.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,10 @@ describe('App.vue', () => {
wrapper = initComponent(App)
wrapper.vm.generatorName = 'test_ge_name'

wrapper.vm.selectGenerator('testGeneratorName');
wrapper.vm.selectGenerator('testGeneratorName', 'Test Generator Name');

expect(wrapper.vm.generatorName).toBe('testGeneratorName')
expect(wrapper.vm.generatorPrettyName).toBe('Test Generator Name')
})

test('onStepValidated - method', () => {
Expand Down

0 comments on commit f8a23bf

Please sign in to comment.