diff --git a/src/lib/mocks/index.ts b/src/lib/mocks/index.ts index da9f664e..bde22c84 100644 --- a/src/lib/mocks/index.ts +++ b/src/lib/mocks/index.ts @@ -7,6 +7,7 @@ import { NODE_IDS, NODE_TEMPLATES } from './node'; import { REACT_IDS, REACT_TEMPLATES } from './react'; import { TS_IDS, TS_TEMPLATES } from './typescript'; import { PHP_IDS, PHP_TEMPLATES } from './php'; +import { VUE_IDS, VUE_TEMPLATES } from './vue'; import { GIT_IDS, GIT_TEMPLATES } from './git'; export const TAGS = { @@ -53,7 +54,7 @@ export const TEMPLATES = { [TAGS.JS]: generateTemplateForTag(JS_IDS, JS_TEMPLATES), [TAGS.Typescript]: generateTemplateForTag(TS_IDS, TS_TEMPLATES), [TAGS.ReactJS]: generateTemplateForTag(REACT_IDS, REACT_TEMPLATES), - [TAGS.VueJS]: [], + [TAGS.VueJS]: generateTemplateForTag(VUE_IDS, VUE_TEMPLATES), [TAGS.NodeJS]: generateTemplateForTag(NODE_IDS, NODE_TEMPLATES), [TAGS.PHP]: generateTemplateForTag(PHP_IDS, PHP_TEMPLATES), [TAGS.GIT]: generateTemplateForTag(GIT_IDS, GIT_TEMPLATES) diff --git a/src/lib/mocks/vue/001_vue_directives.ts b/src/lib/mocks/vue/001_vue_directives.ts new file mode 100644 index 00000000..83eb30b1 --- /dev/null +++ b/src/lib/mocks/vue/001_vue_directives.ts @@ -0,0 +1,172 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js Directives Quiz', + description: 'Test your knowledge of Vue.js directives with practical questions.', + questionnaire: { + questions: [ + { + title: 'What is the purpose of the "v-bind" directive in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To conditionally apply a class to an element', + is_correct: false, + }, + { + label: 'To dynamically bind an attribute to an element', + is_correct: true, + }, + { + label: 'To define a computed property in Vue.js', + is_correct: false, + }, + ], + }, + { + title: 'Which directive is used to loop through an array of items in Vue.js?', + name: 'q2', + points: 1, + order: 1, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'v-model', + is_correct: false, + }, + { + label: 'v-for', + is_correct: true, + }, + { + label: 'v-show', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of the "v-if" and "v-else" directives in Vue.js.', + name: 'q3', + points: 2, + order: 2, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the "v-on" directive in Vue.js?', + name: 'q4', + points: 3, + order: 3, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Which directive is used to two-way bind data in an input element in Vue.js?', + name: 'q5', + points: 1, + order: 4, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'v-bind', + is_correct: false, + }, + { + label: 'v-model', + is_correct: true, + }, + { + label: 'v-on', + is_correct: false, + }, + ], + }, + { + title: 'How do you conditionally apply a class to an element using "v-bind"?', + name: 'q6', + points: 1, + order: 5, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'By using a computed property', + is_correct: false, + }, + { + label: 'By binding the class name to a variable', + is_correct: true, + }, + { + label: 'By using a filter', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of the "v-show" and "v-if" directives in Vue.js.', + name: 'q7', + points: 2, + order: 6, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How do you bind a method to a button click event in Vue.js using "v-on"?', + name: 'q8', + points: 3, + order: 7, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the "v-pre" directive in Vue.js?', + name: 'q9', + points: 1, + order: 8, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To print text directly without any processing', + is_correct: false, + }, + { + label: 'To skip compilation for this element and all its children', + is_correct: true, + }, + { + label: 'To prevent a component from rendering', + is_correct: false, + }, + ], + }, + { + title: 'How can you conditionally render content using the "v-if" directive?', + name: 'q10', + points: 2, + order: 9, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'By using "v-if" and "v-else" together', + is_correct: true, + }, + { + label: 'By using "v-for" with a condition', + is_correct: false, + }, + { + label: 'It is not possible to conditionally render content in Vue.js', + is_correct: false, + }, + ], + }, + ], + }, +}; + +export default template; diff --git a/src/lib/mocks/vue/002_vue_vBind.ts b/src/lib/mocks/vue/002_vue_vBind.ts new file mode 100644 index 00000000..29322fa3 --- /dev/null +++ b/src/lib/mocks/vue/002_vue_vBind.ts @@ -0,0 +1,133 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js v-bind Quiz', + description: 'Test your knowledge of Vue.js v-bind with practical questions.', + questionnaire: { + questions: [ + { + title: 'What is the purpose of the "v-bind" directive in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To conditionally apply a class to an element', + is_correct: false, + }, + { + label: 'To dynamically bind an attribute to an element', + is_correct: true, + }, + { + label: 'To define a computed property in Vue.js', + is_correct: false, + }, + ], + }, + { + title: 'How do you bind an attribute to an element using "v-bind"?', + name: 'q2', + points: 1, + order: 1, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the usage of the "v-bind:class" directive in Vue.js.', + name: 'q3', + points: 2, + order: 2, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the "v-bind:style" directive in Vue.js?', + name: 'q4', + points: 3, + order: 3, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How do you bind the "href" attribute of an anchor tag in Vue.js?', + name: 'q5', + points: 1, + order: 4, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'By using "v-href"', + is_correct: false, + }, + { + label: 'By using "v-bind:href"', + is_correct: true, + }, + { + label: 'By using "v-url"', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of the "v-bind" directive with "v-for" in Vue.js.', + name: 'q6', + points: 1, + order: 5, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How do you bind a method to a button click event using "v-on"?', + name: 'q7', + points: 2, + order: 6, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the "v-bind:key" directive in a "v-for" loop?', + name: 'q8', + points: 3, + order: 7, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you bind an image source dynamically in Vue.js?', + name: 'q9', + points: 1, + order: 8, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'By using "v-src"', + is_correct: false, + }, + { + label: 'By using "v-image"', + is_correct: false, + }, + { + label: 'By using "v-bind:src"', + is_correct: true, + }, + ], + }, + { + title: 'Explain the usage of the "v-bind" directive with "v-model" in Vue.js.', + name: 'q10', + points: 2, + order: 9, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + ], + }, +}; + +export default template; diff --git a/src/lib/mocks/vue/003_vue_vIf.ts b/src/lib/mocks/vue/003_vue_vIf.ts new file mode 100644 index 00000000..7a3c71f5 --- /dev/null +++ b/src/lib/mocks/vue/003_vue_vIf.ts @@ -0,0 +1,133 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js v-if Quiz', + description: 'Test your knowledge of Vue.js v-if with practical questions.', + questionnaire: { + questions: [ + { + title: 'What is the purpose of the "v-if" directive in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To conditionally apply a class to an element', + is_correct: false, + }, + { + label: 'To conditionally render an element based on a condition', + is_correct: true, + }, + { + label: 'To define a computed property in Vue.js', + is_correct: false, + }, + ], + }, + { + title: 'How do you use "v-if" to conditionally render an element in Vue.js?', + name: 'q2', + points: 1, + order: 1, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the usage of "v-else" and "v-else-if" directives in Vue.js.', + name: 'q3', + points: 2, + order: 2, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the "v-show" directive in Vue.js?', + name: 'q4', + points: 3, + order: 3, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How do you conditionally show an element using "v-show" in Vue.js?', + name: 'q5', + points: 1, + order: 4, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'By toggling the element display property', + is_correct: false, + }, + { + label: 'By rendering the element conditionally', + is_correct: true, + }, + { + label: 'By using a computed property', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of "v-if" and "v-show" directives in Vue.js.', + name: 'q6', + points: 1, + order: 5, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you use "v-if" with "v-else" to conditionally render content in Vue.js?', + name: 'q7', + points: 2, + order: 6, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the key difference between "v-if" and "v-show" in Vue.js?', + name: 'q8', + points: 3, + order: 7, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How do you use "v-else-if" to conditionally render content in Vue.js?', + name: 'q9', + points: 1, + order: 8, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'By using "v-else" with a condition', + is_correct: false, + }, + { + label: 'By using "v-else" with multiple conditions', + is_correct: true, + }, + { + label: 'By using "v-show" with a condition', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of "v-if" with "v-for" in Vue.js.', + name: 'q10', + points: 2, + order: 9, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + ], + }, +}; + +export default template; diff --git a/src/lib/mocks/vue/004_vue_vShow.ts b/src/lib/mocks/vue/004_vue_vShow.ts new file mode 100644 index 00000000..ce4dffdf --- /dev/null +++ b/src/lib/mocks/vue/004_vue_vShow.ts @@ -0,0 +1,133 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js v-show Quiz', + description: 'Test your knowledge of Vue.js v-show with practical questions.', + questionnaire: { + questions: [ + { + title: 'What is the purpose of the "v-show" directive in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To conditionally render an element based on a condition', + is_correct: true, + }, + { + label: 'To toggle a class on an element', + is_correct: false, + }, + { + label: 'To define a computed property in Vue.js', + is_correct: false, + }, + ], + }, + { + title: 'How do you use "v-show" to conditionally display an element in Vue.js?', + name: 'q2', + points: 1, + order: 1, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the key difference between "v-show" and "v-if" directives in Vue.js.', + name: 'q3', + points: 2, + order: 2, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'In what scenarios is "v-show" typically preferred over "v-if" in Vue.js?', + name: 'q4', + points: 3, + order: 3, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How do you conditionally show an element using "v-show" in Vue.js?', + name: 'q5', + points: 1, + order: 4, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'By rendering the element conditionally', + is_correct: true, + }, + { + label: 'By toggling the element display property', + is_correct: false, + }, + { + label: 'By using a computed property', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of "v-show" with "v-else" in Vue.js.', + name: 'q6', + points: 1, + order: 5, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you use "v-show" with "v-else-if" to conditionally render content in Vue.js?', + name: 'q7', + points: 2, + order: 6, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the key difference between "v-show" and "v-if" in terms of rendering in Vue.js?', + name: 'q8', + points: 3, + order: 7, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How do you use "v-else-if" with "v-show" to conditionally render content in Vue.js?', + name: 'q9', + points: 1, + order: 8, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'By using "v-else" with a condition', + is_correct: true, + }, + { + label: 'By using "v-else" with multiple conditions', + is_correct: false, + }, + { + label: 'By using "v-if" with a condition', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of "v-show" with "v-for" in Vue.js.', + name: 'q10', + points: 2, + order: 9, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + ], + }, +}; + +export default template; diff --git a/src/lib/mocks/vue/005_vue_vFor.ts b/src/lib/mocks/vue/005_vue_vFor.ts new file mode 100644 index 00000000..82238508 --- /dev/null +++ b/src/lib/mocks/vue/005_vue_vFor.ts @@ -0,0 +1,133 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js v-for Quiz', + description: 'Test your knowledge of Vue.js v-for with practical questions.', + questionnaire: { + questions: [ + { + title: 'What is the main purpose of the "v-for" directive in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To conditionally render an element based on a condition', + is_correct: false, + }, + { + label: 'To iterate over an array and render elements for each item', + is_correct: true, + }, + { + label: 'To define a computed property in Vue.js', + is_correct: false, + }, + ], + }, + { + title: 'How do you use "v-for" to iterate over an array and render elements in Vue.js?', + name: 'q2', + points: 1, + order: 1, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the key usage of "v-for" in a Vue.js template.', + name: 'q3', + points: 2, + order: 2, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the difference between "v-for" and "v-if" in Vue.js?', + name: 'q4', + points: 3, + order: 3, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you get the index of the current iteration in a "v-for" loop in Vue.js?', + name: 'q5', + points: 1, + order: 4, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'By using a computed property', + is_correct: false, + }, + { + label: 'By referencing the index variable', + is_correct: true, + }, + { + label: 'By using "v-index" directive', + is_correct: false, + }, + ], + }, + { + title: 'Explain how "v-for" can be used to render a list of items with Vue.js.', + name: 'q6', + points: 1, + order: 5, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you conditionally render items in a "v-for" loop based on a condition?', + name: 'q7', + points: 2, + order: 6, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the "key" attribute when using "v-for"?', + name: 'q8', + points: 3, + order: 7, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the main advantage of using "v-for" in Vue.js?', + name: 'q9', + points: 1, + order: 8, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To create computed properties', + is_correct: false, + }, + { + label: 'To simplify rendering lists of data', + is_correct: true, + }, + { + label: 'To conditionally render elements', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of "v-for" with nested loops in Vue.js.', + name: 'q10', + points: 2, + order: 9, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + ], + }, +}; + +export default template; diff --git a/src/lib/mocks/vue/006_vue-vEvents.ts b/src/lib/mocks/vue/006_vue-vEvents.ts new file mode 100644 index 00000000..ba0caeab --- /dev/null +++ b/src/lib/mocks/vue/006_vue-vEvents.ts @@ -0,0 +1,120 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js Events Quiz', + description: 'Test your knowledge of Vue.js events with practical questions.', + questionnaire: { + questions: [ + { + title: 'What is the primary purpose of event handling in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To create computed properties', + is_correct: false, + }, + { + label: 'To manage user interactions and respond to them', + is_correct: true, + }, + { + label: 'To define data properties in Vue.js', + is_correct: false, + }, + ], + }, + { + title: 'How can you attach a click event handler to an element in Vue.js?', + name: 'q2', + points: 1, + order: 1, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the syntax for binding a method to an event in Vue.js?', + name: 'q3', + points: 2, + order: 2, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you pass data to an event handler in Vue.js?', + name: 'q4', + points: 3, + order: 3, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the purpose of the "@" symbol in Vue.js event binding.', + name: 'q5', + points: 1, + order: 4, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the difference between "v-on" and "v-bind" in Vue.js event handling?', + name: 'q6', + points: 1, + order: 5, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you prevent the default behavior of an event in Vue.js?', + name: 'q7', + points: 2, + order: 6, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the concept of event modifiers in Vue.js.', + name: 'q8', + points: 3, + order: 7, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the "stop" event modifier in Vue.js?', + name: 'q9', + points: 1, + order: 8, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To stop event propagation', + is_correct: true, + }, + { + label: 'To stop the event handler', + is_correct: false, + }, + { + label: 'To stop event bubbling', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of the "once" event modifier in Vue.js.', + name: 'q10', + points: 2, + order: 9, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + ], + }, +}; + +export default template; diff --git a/src/lib/mocks/vue/007_vue_vOn.ts b/src/lib/mocks/vue/007_vue_vOn.ts new file mode 100644 index 00000000..e794c864 --- /dev/null +++ b/src/lib/mocks/vue/007_vue_vOn.ts @@ -0,0 +1,120 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js v-on Directives Quiz', + description: 'Test your knowledge of Vue.js v-on directives with practical questions.', + questionnaire: { + questions: [ + { + title: 'What is the primary purpose of the v-on directive in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To create data properties', + is_correct: false, + }, + { + label: 'To manage user interactions and respond to events', + is_correct: true, + }, + { + label: 'To define computed properties', + is_correct: false, + }, + ], + }, + { + title: 'How can you attach a click event handler to an element using v-on?', + name: 'q2', + points: 1, + order: 1, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the syntax for binding a method to an event using v-on?', + name: 'q3', + points: 2, + order: 2, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you pass data to an event handler using v-on?', + name: 'q4', + points: 3, + order: 3, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the purpose of the "@click" syntax in v-on event binding.', + name: 'q5', + points: 1, + order: 4, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the difference between "v-on" and "v-bind" in Vue.js?', + name: 'q6', + points: 1, + order: 5, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you prevent the default behavior of an event using v-on?', + name: 'q7', + points: 2, + order: 6, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the concept of event modifiers in Vue.js v-on directives.', + name: 'q8', + points: 3, + order: 7, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the ".stop" event modifier in Vue.js v-on directives?', + name: 'q9', + points: 1, + order: 8, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To stop event propagation', + is_correct: true, + }, + { + label: 'To stop the event handler', + is_correct: false, + }, + { + label: 'To stop event bubbling', + is_correct: false, + }, + ], + }, + { + title: 'Explain the usage of the ".once" event modifier in Vue.js v-on directives.', + name: 'q10', + points: 2, + order: 9, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + ], + }, +}; + +export default template; diff --git a/src/lib/mocks/vue/008_vue_methods.ts b/src/lib/mocks/vue/008_vue_methods.ts new file mode 100644 index 00000000..1b84fd45 --- /dev/null +++ b/src/lib/mocks/vue/008_vue_methods.ts @@ -0,0 +1,120 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js Methods Quiz', + description: 'Test your knowledge of Vue.js methods with practical questions.', + questionnaire: { + questions: [ + { + title: 'What is the primary purpose of methods in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To define computed properties', + is_correct: false, + }, + { + label: 'To manage user interactions and create custom functions', + is_correct: true, + }, + { + label: 'To style the components', + is_correct: false, + }, + ], + }, + { + title: 'How do you define a method in a Vue component?', + name: 'q2', + points: 1, + order: 1, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the purpose of the "methods" property in a Vue component.', + name: 'q3', + points: 2, + order: 2, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you call a method defined in a Vue component from the template?', + name: 'q4', + points: 3, + order: 3, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the key difference between "computed properties" and "methods" in Vue.js?', + name: 'q5', + points: 1, + order: 4, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the concept of "method binding" in Vue.js.', + name: 'q6', + points: 1, + order: 5, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How can you pass arguments to a method when calling it from the template?', + name: 'q7', + points: 2, + order: 6, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the "this" keyword in Vue.js methods?', + name: 'q8', + points: 3, + order: 7, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the usage of the ".prevent" modifier in Vue.js event handling methods.', + name: 'q9', + points: 1, + order: 8, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To prevent event propagation', + is_correct: false, + }, + { + label: 'To prevent the default behavior of an event', + is_correct: true, + }, + { + label: 'To prevent the method execution', + is_correct: false, + }, + ], + }, + { + title: 'How can you reuse a method defined in a Vue component in another component?', + name: 'q10', + points: 2, + order: 9, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + ], + }, +}; + +export default template; diff --git a/src/lib/mocks/vue/009_vue_eventModifiers.ts b/src/lib/mocks/vue/009_vue_eventModifiers.ts new file mode 100644 index 00000000..74e8fa12 --- /dev/null +++ b/src/lib/mocks/vue/009_vue_eventModifiers.ts @@ -0,0 +1,120 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js Event Modifiers Quiz', + description: 'Test your knowledge of Vue.js event modifiers with practical questions.', + questionnaire: { + questions: [ + { + title: 'What is the purpose of the ".stop" event modifier in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To stop event propagation', + is_correct: true, + }, + { + label: 'To prevent the default behavior of an event', + is_correct: false, + }, + { + label: 'To stop the method execution', + is_correct: false, + }, + ], + }, + { + title: 'How can you use the ".prevent" event modifier in Vue.js?', + name: 'q2', + points: 1, + order: 1, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the purpose of the ".capture" event modifier in Vue.js.', + name: 'q3', + points: 2, + order: 2, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What does the ".self" event modifier do in Vue.js?', + name: 'q4', + points: 3, + order: 3, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'How do you use the ".once" event modifier in Vue.js?', + name: 'q5', + points: 1, + order: 4, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain the ".passive" event modifier in Vue.js and its use cases.', + name: 'q6', + points: 1, + order: 5, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the purpose of the ".ctrl" event modifier in Vue.js?', + name: 'q7', + points: 2, + order: 6, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'Explain how to use the ".exact" event modifier in Vue.js and its significance.', + name: 'q8', + points: 3, + order: 7, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + { + title: 'What is the use of the ".middle" event modifier in Vue.js?', + name: 'q9', + points: 1, + order: 8, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'To handle middle mouse button clicks', + is_correct: true, + }, + { + label: 'To handle right mouse button clicks', + is_correct: false, + }, + { + label: 'To handle left mouse button clicks', + is_correct: false, + }, + ], + }, + { + title: 'How can you combine multiple event modifiers in Vue.js?', + name: 'q10', + points: 2, + order: 9, + question_type: QuestionTypes[2], // TEXTAREA + options: [], + }, + ], + }, +}; + +export default template; diff --git a/src/lib/mocks/vue/010_vue_forms.ts b/src/lib/mocks/vue/010_vue_forms.ts new file mode 100644 index 00000000..ad9b5a60 --- /dev/null +++ b/src/lib/mocks/vue/010_vue_forms.ts @@ -0,0 +1,172 @@ +import { QuestionTypes } from '../utils'; + +import type { ExerciseTemplate } from '$lib/utils/types'; + +const template: ExerciseTemplate = { + title: 'Vue.js Forms Quiz', + description: 'Test your knowledge of Vue.js forms with practical questions.', + questionnaire: { + questions: [ + { + title: 'How do you create a text input field in Vue.js?', + name: 'q1', + points: 2, + order: 0, + question_type: QuestionTypes[0], // RADIO + options: [ + { + label: 'Using the element', + is_correct: true, + }, + { + label: 'Using the