Skip to content

Commit 828e639

Browse files
committed
fixed parent/child relationship in codesnippet
> > Co-authored-by: Chris Davis <[email protected]> Co-authored-by: Ji Kim <[email protected]> Co-authored-by: Jigar Patel <[email protected]> Co-authored-by: Linden Young <[email protected]>
1 parent 1c78c38 commit 828e639

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/components/nav-buttons/ExportMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,10 @@ test('renders ${componentName}', () => {
365365
arrOfChildComp.forEach(childName => {
366366
let childNameClass = this.componentMap[childName].htmlAttributes.class;
367367
let childNameClassFullStr = (childNameClass === "") ? "" : ` class = '${childNameClass}'`;
368-
routeStr += `<${childName}${childNameClassFullStr}></${childName}>\n`
368+
routeStr += ` <${childName}${childNameClassFullStr}></${childName}>\n`
369369
});
370370
371-
return `<template>\n <div>\n\t${str}${templateTagStr}${routeStr} </div>\n</template>`;
371+
return `<template>\n <div>\n${str}${templateTagStr}${routeStr} </div>\n</template>`;
372372
}
373373
}
374374
else {

src/components/right-sidebar/CodeSnippet.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,26 @@ export default {
7676
// Creates beginner boilerplate
7777
createTemplate(componentName) {
7878
let templateTagStr = this.writeTemplateTag(componentName);
79-
79+
if (this.activeComponentObj.htmlAttributes) {
8080
//if/else statement to determine if there are class and id attributes present in the html element
8181
if (this.activeComponentObj.htmlAttributes.class !== "" && this.activeComponentObj.htmlAttributes.id !== "") {
8282
return `<template>\n <div id = "${this.activeComponentObj.htmlAttributes.id}" class = "${this.activeComponentObj.htmlAttributes.class}">\n${templateTagStr} </div>\n</template>`;
8383
} else if (this.activeComponentObj.htmlAttributes.class !== "" && this.activeComponentObj.htmlAttributes.id === "") {
8484
return `<template>\n <div class = "${this.activeComponentObj.htmlAttributes.class}">\n${templateTagStr} </div>\n</template>`;
8585
} else if (this.activeComponentObj.htmlAttributes.class === "" && this.activeComponentObj.htmlAttributes.id !== "")
8686
return `<template>\n <div id = "${this.activeComponentObj.htmlAttributes.id}">\n${templateTagStr} </div>\n</template>`;
87+
else {
88+
let routeStr = '';
89+
const arrOfChildComp = this.componentMap[componentName].children;
90+
arrOfChildComp.forEach(childName => {
91+
let childNameClass = this.componentMap[childName].htmlAttributes.class;
92+
let childNameClassFullStr = (childNameClass === "") ? "" : ` class = '${childNameClass}'`;
93+
routeStr += ` <${childName}${childNameClassFullStr}></${childName}>\n`
94+
});
95+
96+
return `<template>\n <div>\n${templateTagStr}${routeStr} </div>\n</template>`;
97+
}
98+
}
8799
else return `<template>\n <div>\n${templateTagStr} </div>\n</template>`;
88100
},
89101
// Creates <template> boilerplate

0 commit comments

Comments
 (0)