Skip to content

Commit 45a668f

Browse files
export test config and dev
1 parent 9cc98e8 commit 45a668f

File tree

7 files changed

+88
-10
lines changed

7 files changed

+88
-10
lines changed

src/components/Canvas.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<template>
88
<!-- the background Canvas grid -->
99
<div class="component-display grid-bg" :style="{backgroundColor:'#FFFFF' }" v-on:click="handleClick" v-on:click.right="handleRight">
10-
<div class="cssContainer" :style="{
11-
'background-size': `${gridWidth}px ${gridHeight}px,
12-
${gridWidth}px ${gridHeight}px`,
13-
'height': `${this.containerH}px`, 'width': `${this.containerW}px`
10+
<div class="cssContainer" :style="{
11+
'background-size': `${gridWidth}px ${gridHeight}px,
12+
${gridWidth}px ${gridHeight}px`,
13+
'height': `${this.containerH}px`, 'width': `${this.containerW}px`
1414
}">
1515
<!-- This is the actual component box -->
1616
<!-- https://www.npmjs.com/package/vue-draggable-resizable -->
@@ -72,7 +72,7 @@
7272
{'background-color': componentData.color}]"
7373
>
7474
<p class="innerHtmlText" style="font-size: 3em">{{element.note !== '' ? element.note : element.text}}</p>
75-
</div>sss
75+
</div>
7676
<div v-if="element.text === 'footer'" class="htmlFooter"></div>
7777
<div v-if="element.text === 'form'"
7878
class="htmlGeneral"
@@ -472,7 +472,7 @@ export default {
472472
// find the amount of grid lines for width
473473
gridWidth() {
474474
return this.containerW / this.gridLayout[0];
475-
},
475+
},
476476
// find the amount of grid lines for height
477477
gridHeight() {
478478
return this.containerH / this.gridLayout[1];
@@ -528,7 +528,7 @@ export default {
528528
// if (this.activeComponent !== e.target.id) {
529529
// if (e.target.parentElement?.classList.contains('draggable')) {
530530
// // this.setActiveComponent(e.target.parentElement.id)
531-
// }
531+
// }
532532
// else if (typeof `${e.target.id}` !== 'number') {
533533
// // this.setActiveComponent(e.target.id);
534534
// }

src/components/nav-buttons/ExportMenu.vue

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ export default {
311311
}
312312
}
313313
else {
314-
if(this.$store.state.exportOauth ==='on'||this.$store.state.exportOauthGithub ==='on'){return `<template>\n\t${str}${templateTagStr}${routeStr}</div>\n<Oauth/>\n</template>`}
314+
315315
return `<template>\n\t${str}${templateTagStr}${routeStr}</div>\n</template>`
316316
}
317317
},
@@ -508,6 +508,25 @@ export default {
508508
fs.writeFileSync(path.join(location, "firebaseConfig.js"), str);
509509
}
510510
},
511+
512+
createjestConfigFile(location){
513+
if(this.$store.state.importTest ==='on'){
514+
let str = `module.exports = {`;
515+
str += `\n\tpreset: '@vue/cli-plugin-unit-jest'`;
516+
str += `\n}`
517+
fs.writeFileSync(path.join(location,"jest.config.js"), str);
518+
}
519+
},
520+
createbabelConfigFile(location){
521+
if(this.$store.state.importTest ==='on'){
522+
let str = `module.exports = {`;
523+
str += `\n\tpresets: [`;
524+
str += `\n\t\t'@vue/cli-plugin-babel/preset'`;
525+
str += `\n\t]`;
526+
str += `\n}`
527+
fs.writeFileSync(path.join(location,"babel.config.js"), str);
528+
}
529+
},
511530
createOauthFile(location){
512531
if(this.$store.state.exportOauth ==='on'||this.$store.state.exportOauthGithub ==='on'){
513532
let str = `<template>`;
@@ -784,6 +803,18 @@ export default {
784803
str += `\n\t\t"eslint": "^8.5.0",`;
785804
str += `\n\t\t"eslint-plugin-vue": "^8.2.0",`;
786805
str += `\n\t\t"vite": "^2.8.4"`
806+
if(this.$store.state.importTest ==='on'){
807+
str+=`,\n\t\t"@babel/core": "^7.12.16",`
808+
str+=`\n\t\t"@babel/eslint-parser": "^7.12.16",`
809+
str+=`\n\t\t"@vue/cli-plugin-babel": "~5.0.0",`
810+
str+=`\n\t\t"@vue/cli-plugin-eslint": "~5.0.0",`
811+
str+=`\n\t\t"@vue/cli-plugin-unit-jest": "~5.0.0",`
812+
str+=`\n\t\t"@vue/cli-service": "~5.0.0",`
813+
str+=`\n\t\t"@vue/test-utils": "^2.0.0-0",`
814+
str+=`\n\t\t"@vue/vue3-jest": "^27.0.0-alpha.1",`
815+
str+=`\n\t\t"babel-jest": "^27.0.6",`
816+
str+=`\n\t\t"jest": "^27.0.5"`
817+
}
787818
if (this.exportAsTypescript === "on") {
788819
str += `,\n\t\t"@rushstack/eslint-patch": "^1.1.0",`
789820
str += `\n\t\t"@vue/tsconfig": "^0.1.3",`;
@@ -819,6 +850,8 @@ export default {
819850
this.createStore(data);
820851
this.createFirebaseConfigFile(data);
821852
this.createOauthFile(data);
853+
this.createjestConfigFile(data);
854+
this.createbabelConfigFile(data)
822855
// exports images to the /assets folder
823856
// eslint-disable-next-line no-unused-vars
824857
for (let [routeImage, imageLocation] of Object.entries(this.imagePath)) {

src/layouts/MyLayout.vue

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ Description:
6767
<span class="switch-handle" :value="this.exportAsTypescript"></span>
6868
</label>
6969
</div>
70+
71+
<div class="Test">
72+
<p class="Test-text"> <b>
73+
Vue Test:
74+
75+
</b> </p>
76+
<label for="Test" class="switch" >
77+
<input v-if="this.importTest === 'on'" class="switch-input" type="checkbox" name="Test" id="Test" :value="this.importTest" @change="syncTestFlag" checked/>
78+
<input v-else class="switch-input" type="checkbox" name="Test" id="Test" :value="this.importTest" @change="syncTestFlag"/>
79+
<span class="switch-label" :value="this.importTest" data-on="on" data-off="off"></span>
80+
<span class="switch-handle" :value="this.importTest"></span>
81+
</label>
82+
</div>
83+
7084
<div class="drawer">
7185
<q-expansion-item group="accordion" label="Create Oauth" >
7286
<div class="Oauth">
@@ -95,6 +109,7 @@ Description:
95109
</label>
96110
</div>
97111
</q-expansion-item>
112+
98113
</div>
99114
</div>
100115
<i id="btn"></i>
@@ -212,7 +227,7 @@ export default {
212227
GridDensity
213228
},
214229
computed: {
215-
...mapState(["exportAsTypescript","exportOauth","exportOauthGithub"]),
230+
...mapState(["exportAsTypescript","exportOauth","exportOauthGithub","importTest"]),
216231
},
217232
methods: {
218233
...mapActions(["toggleTutorial"]),
@@ -267,6 +282,19 @@ export default {
267282
}
268283
this.$store.commit("EXPORT_AS_TYPESCRIPT", checkboxValue);
269284
},
285+
syncTestFlag(e) {
286+
console.log(this.$store.state.importTest )
287+
288+
let checkboxValue;
289+
if (e.target.value === "off") {
290+
checkboxValue = "on";
291+
} else {
292+
checkboxValue = "off";
293+
}
294+
this.$store.commit("EXPORT_TEST", checkboxValue);
295+
console.log(this.$store.state.importTest )
296+
297+
},
270298
syncOauthFlag(e) {
271299
272300
let checkboxValue;
@@ -628,4 +656,15 @@ q-btn > i {
628656
margin-left: 25px;
629657
630658
}
659+
.Test{
660+
661+
display: flex;
662+
align-items: flex-end;
663+
margin: 10px;
664+
flex-direction: row;
665+
666+
}
667+
.Test-text{
668+
margin-right: 10px;
669+
}
631670
</style>

src/store/mutations.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ const mutations = {
116116
[types.EXPORT_OAUTH_GIT]: (state, payload) => {
117117
state.exportOauthGithub = payload;
118118
},
119+
[types.EXPORT_TEST]: (state, payload) => {
120+
state.importTest = payload;
121+
},
119122

120123
[types.CREATE_ACTION]: (state, payload) => {
121124
state.userActions.push(payload);

src/store/state/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ const newState :types.State = {
7272
containerH: 720, // in px
7373
containerW: 1280, // in px
7474
importLibraries:[],
75-
displaylibComponent:false
75+
displaylibComponent:false,
76+
importTest:'off'
7677
//push libraries string to the array
7778
};
7879

src/store/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const DELETE_USER_STATE = 'DELETE_USER_STATE'
6969
export const EXPORT_AS_TYPESCRIPT = 'EXPORT_AS_TYPESCRIPT'
7070
export const EXPORT_OAUTH = 'EXPORT_OAUTH'
7171
export const EXPORT_OAUTH_GIT = 'EXPORT_OAUTH_GIT'
72+
export const EXPORT_TEST = 'EXPORT_TEST'
7273
export const TOGGLE_TUTORIAL = 'TOGGLE_TUTORIAL'
7374
export const ADD_ACTIVE_COMPONENT_NOTE = 'ADD_ACTIVE_COMPONENT_NOTE'
7475
export const DELETE_ACTIVE_COMPONENT_NOTE = 'DELETE_ACTIVE_COMPONENT_NOTE'

types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export type State = {
5959
containerW: number,
6060
importLibraries: string[],
6161
displaylibComponent: boolean,
62+
importTest:string
6263
};
6364

6465
// Type for HTML Element Map that used in multiple files

0 commit comments

Comments
 (0)