first commit
This commit is contained in:
18
ui/generators/new/layout/layout.ejs.t
Normal file
18
ui/generators/new/layout/layout.ejs.t
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
to: "src/router/layouts/<%= h.changeCase.kebab(name) %>.vue"
|
||||
---
|
||||
<template>
|
||||
<div :class="$style.container">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" module>
|
||||
@import '@design';
|
||||
|
||||
.container {
|
||||
min-width: $size-content-width-min;
|
||||
max-width: $size-content-width-max;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
13
ui/generators/new/layout/prompt.js
Normal file
13
ui/generators/new/layout/prompt.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = [
|
||||
{
|
||||
type: 'input',
|
||||
name: 'name',
|
||||
message: 'Name:',
|
||||
validate(value) {
|
||||
if (!value.length) {
|
||||
return 'Layout components must have a name.'
|
||||
}
|
||||
return true
|
||||
},
|
||||
},
|
||||
]
|
||||
19
ui/generators/new/layout/unit.ejs.t
Normal file
19
ui/generators/new/layout/unit.ejs.t
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
to: "src/router/layouts/<%= h.changeCase.kebab(name) %>.unit.js"
|
||||
---
|
||||
<%
|
||||
const fileName = h.changeCase.kebab(name)
|
||||
const importName = h.changeCase.pascal(fileName) + 'Layout'
|
||||
%>import <%= importName %> from './<%= fileName %>'
|
||||
|
||||
describe('@layouts/<%= fileName %>', () => {
|
||||
it('renders its content', () => {
|
||||
const slotContent = '<p>Hello!</p>'
|
||||
const { element } = shallowMount(<%= importName %>, {
|
||||
slots: {
|
||||
default: slotContent,
|
||||
},
|
||||
})
|
||||
expect(element.innerHTML).toContain(slotContent)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user