fix: template fixes, updates and refactors

This commit is contained in:
woothu
2019-10-25 18:32:56 +02:00
parent 4f43f966a9
commit e670826803
19 changed files with 106 additions and 79 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
<template> <template>
<CFooter> <CFooter>
<div> <div>
<a href="https://coreui.io">CoreUI</a> <a href="https://coreui.io" target="_blank">CoreUI</a>
<span class="ml-1">&copy; 2019 creativeLabs.</span> <span class="ml-1">&copy; 2019 creativeLabs.</span>
</div> </div>
<div class="ml-auto"> <div class="ml-auto">
<span class="mr-1">Powered by</span> <span class="mr-1">Powered by</span>
<a href="https://coreui.io">CoreUI for Vue</a> <a href="https://coreui.io/vue" target="_blank">CoreUI for Vue</a>
</div> </div>
</CFooter> </CFooter>
</template> </template>
+7 -6
View File
@@ -2,20 +2,21 @@
<CHeader fixed with-subheader light> <CHeader fixed with-subheader light>
<CToggler <CToggler
in-header in-header
class="c-header-toggler ml-3 d-lg-none" class="ml-3 d-lg-none"
v-c-emit-root-event:toggle-sidebar-mobile v-c-emit-root-event:toggle-sidebar-mobile
/> />
<CToggler <CToggler
in-header in-header
class="c-header-toggler ml-3 d-md-down-none" class="ml-3 d-md-down-none"
v-c-emit-root-event:toggle-sidebar v-c-emit-root-event:toggle-sidebar
/> />
<img <CHeaderBrand
class="c-header-brand mx-auto d-lg-none" class="mx-auto d-lg-none"
src="img/brand/coreui-base.svg" src="img/brand/coreui-base.svg"
width="97" width="97"
height="46" height="46"
alt="CoreUI Logo" alt="CoreUI Logo"
:wrappedInLink="{ href: 'https://coreui.io', target: '_blank'}"
/> />
<CHeaderNav class="d-md-down-none mr-auto"> <CHeaderNav class="d-md-down-none mr-auto">
<CHeaderNavItem class="px-3" to="/dashboard">Dashboard</CHeaderNavItem> <CHeaderNavItem class="px-3" to="/dashboard">Dashboard</CHeaderNavItem>
@@ -34,9 +35,9 @@
</CHeaderNavItem> </CHeaderNavItem>
<TheHeaderDropdownAccnt/> <TheHeaderDropdownAccnt/>
</CHeaderNav> </CHeaderNav>
<div class="c-subheader px-3"> <CSubheader class="px-3">
<CBreadcrumbRouter class="border-0"/> <CBreadcrumbRouter class="border-0"/>
</div> </CSubheader>
</CHeader> </CHeader>
</template> </template>
+3 -5
View File
@@ -5,17 +5,16 @@
class="c-header-nav-items" class="c-header-nav-items"
placement="bottom-end" placement="bottom-end"
add-menu-classes="pt-0" add-menu-classes="pt-0"
:show.sync="show"
> >
<template #toggler> <template #toggler>
<CLink class="c-header-nav-link" @click="show = !show"> <CHeaderNavItem only-link>
<div class="c-avatar"> <div class="c-avatar">
<img <img
src="img/avatars/6.jpg" src="img/avatars/6.jpg"
class="c-avatar-img " class="c-avatar-img "
/> />
</div> </div>
</CLink> </CHeaderNavItem>
</template> </template>
<CDropdownHeader tag="div" class="text-center" color="light"> <CDropdownHeader tag="div" class="text-center" color="light">
<strong>Account</strong> <strong>Account</strong>
@@ -72,8 +71,7 @@ export default {
name: 'TheHeaderDropdownAccnt', name: 'TheHeaderDropdownAccnt',
data () { data () {
return { return {
itemsCount: 42, itemsCount: 42
show: false
} }
} }
} }
+2 -2
View File
@@ -5,8 +5,8 @@
:show.sync="show" :show.sync="show"
> >
<CSidebarBrand <CSidebarBrand
fullSrc="img/brand/coreui-base-white.svg" :imgFull="{ width: 118, height: 46, alt: 'Logo', src: 'img/brand/coreui-base-white.svg'}"
minimizedSrc="img/brand/coreui-signet-white.svg" :imgMinimized="{ width: 118, height: 46, alt: 'Logo', src: 'img/brand/coreui-signet-white.svg'}"
:wrappedInLink="{ href: 'https://coreui.io/', target: '_blank'}" :wrappedInLink="{ href: 'https://coreui.io/', target: '_blank'}"
/> />
<!-- <CSidebarHeader/> --> <!-- <CSidebarHeader/> -->
+1 -1
View File
@@ -32,7 +32,7 @@ export default {
return { return {
items: [ items: [
{ {
text: '<b>Admin</b>', text: 'Admin',
href: '#' href: '#'
}, },
{ {
+10 -5
View File
@@ -17,16 +17,20 @@
</div> </div>
</CCardHeader> </CCardHeader>
<CCardBody> <CCardBody>
<CButton id="collapse1" color="primary"> <CButton @click="collapse = !collapse" color="primary">
Toggle Collapse Toggle Collapse
</CButton> </CButton>
<CCollapse toggler="collapse1" class="mt-2"> <CCollapse :show="collapse" class="mt-2">
<CCard body-wrapper> <CCard body-wrapper>
<p class="card-text">Collapse contents Here</p> <p class="card-text">Collapse contents Here</p>
<CButton id="collapse2" size="sm" color="secondary"> <CButton
@click="innerCollapse = !innerCollapse"
size="sm"
color="secondary"
>
Toggle Inner Collapse Toggle Inner Collapse
</CButton> </CButton>
<CCollapse toggler="collapse2" class="mt-2"> <CCollapse :show="innerCollapse" class="mt-2">
<CCard body-wrapper>Hello!</CCard> <CCard body-wrapper>Hello!</CCard>
</CCollapse> </CCollapse>
</CCard> </CCard>
@@ -42,7 +46,8 @@ export default {
name: 'Collapses', name: 'Collapses',
data () { data () {
return { return {
showCollapse: true, collapse: false,
innerCollapse: false,
text: ` text: `
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry
richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor
+1 -2
View File
@@ -149,11 +149,10 @@
horizontal horizontal
disabled disabled
/> />
<CInput <CTextarea
label="Textarea" label="Textarea"
placeholder="Content..." placeholder="Content..."
horizontal horizontal
textarea="true"
rows="9" rows="9"
/> />
<CSelect <CSelect
+7 -4
View File
@@ -18,7 +18,9 @@
</div> </div>
</CCardHeader> </CCardHeader>
<CCardBody> <CCardBody>
<CJumbotron header="Bootstrap 4" lead="Bootstrap 4 Components for Vue.js 2"> <CJumbotron>
<h1 class="display-3">Bootstrap 4</h1>
<p class="lead">Bootstrap 4 Components for Vue.js 2</p>
<p>For more information visit website</p> <p>For more information visit website</p>
<CButton color="primary" href="#">More Info</CButton> <CButton color="primary" href="#">More Info</CButton>
</CJumbotron> </CJumbotron>
@@ -33,7 +35,8 @@
</CCardHeader> </CCardHeader>
<CCardBody> <CCardBody>
<CJumbotron header="Bootstrap 4" lead=""> <CJumbotron header="Bootstrap 4" lead="">
<p slot="lead" class="lead"> <h1 class="display-3">Bootstrap 4</h1>
<p class="lead">
This is a simple hero unit, a simple jumbotron-style component for This is a simple hero unit, a simple jumbotron-style component for
calling extra attention to featured content or information. calling extra attention to featured content or information.
</p> </p>
@@ -61,9 +64,9 @@
color="info" color="info"
text-color="white" text-color="white"
border-color="dark" border-color="dark"
header="Bootstrap 4"
> >
<p slot="lead" class="lead"> <h1 class="display-3">Bootstrap 4</h1>
<p class="lead">
This is a simple hero unit, a simple jumbotron-style component for This is a simple hero unit, a simple jumbotron-style component for
calling extra attention to featured content or information. calling extra attention to featured content or information.
</p> </p>
+1 -1
View File
@@ -91,7 +91,7 @@
<CNavbarBrand>CoreuiVue</CNavbarBrand> <CNavbarBrand>CoreuiVue</CNavbarBrand>
<CCollapse :show="navbarText" navbar> <CCollapse :show="navbarText" navbar>
<CNavbarNav> <CNavbarNav>
<span class="navbar-text">Navbar text</span> <CNavbarText>Navbar text</CNavbarText>
</CNavbarNav> </CNavbarNav>
</CCollapse> </CCollapse>
</CNavbar> </CNavbar>
+9 -8
View File
@@ -100,7 +100,7 @@
<CAlert <CAlert
color="secondary" color="secondary"
closeButton closeButton
:show.sync="dismissibleAlerts[0]" :show.sync="alert1"
> >
Dismissible Alert! Dismissible Alert!
</CAlert> </CAlert>
@@ -109,15 +109,14 @@
color="secondary" color="secondary"
closeButton closeButton
fade fade
:show.sync="dismissibleAlerts[1]" :show.sync="alert2"
> >
Dismissible Alert with fade effect! Dismissible Alert with fade effect!
</CAlert> </CAlert>
<CAlert <CAlert
color="secondary" color="secondary"
:show.sync="dismissibleAlerts[2]" :show.sync="alert3"
v-slot="{dismiss}"
class="alert-dismissible" class="alert-dismissible"
> >
Dismissible Alert with custom button! Dismissible Alert with custom button!
@@ -125,9 +124,9 @@
class="position-absolute" class="position-absolute"
color="secondary" color="secondary"
style="right:10px;top: 50%;transform: translateY(-50%);" style="right:10px;top: 50%;transform: translateY(-50%);"
@click="dismiss" @click="alert3 = false"
> >
<i>Close</i> Close
</CButton> </CButton>
</CAlert> </CAlert>
<CButton <CButton
@@ -186,7 +185,9 @@ export default {
return { return {
dismissSecs: 10, dismissSecs: 10,
dismissCountDown: 10, dismissCountDown: 10,
dismissibleAlerts: [true, true, true], alert1: true,
alert2: true,
alert3: true
} }
}, },
methods: { methods: {
@@ -197,7 +198,7 @@ export default {
this.dismissCountDown = this.dismissSecs this.dismissCountDown = this.dismissSecs
}, },
showDismissibleAlerts () { showDismissibleAlerts () {
this.dismissibleAlerts = this.dismissibleAlerts.map(el => el = true) ['alert1', 'alert2', 'alert3'].forEach(alert => this[alert] = true)
} }
} }
} }
@@ -7,6 +7,7 @@ exports[`TheFooter.vue renders correctly 1`] = `
<div> <div>
<a <a
href="https://coreui.io" href="https://coreui.io"
target="_blank"
> >
CoreUI CoreUI
</a> </a>
@@ -28,7 +29,8 @@ exports[`TheFooter.vue renders correctly 1`] = `
</span> </span>
<a <a
href="https://coreui.io" href="https://coreui.io/vue"
target="_blank"
> >
CoreUI for Vue CoreUI for Vue
</a> </a>
@@ -9,23 +9,24 @@ exports[`TheHeader.vue renders correctly 1`] = `
withsubheader="true" withsubheader="true"
> >
<ctoggler-stub <ctoggler-stub
class="c-header-toggler ml-3 d-lg-none" class="ml-3 d-lg-none"
inheader="true" inheader="true"
tag="button" tag="button"
/> />
<ctoggler-stub <ctoggler-stub
class="c-header-toggler ml-3 d-md-down-none" class="ml-3 d-md-down-none"
inheader="true" inheader="true"
tag="button" tag="button"
/> />
<img <cheaderbrand
alt="CoreUI Logo" alt="CoreUI Logo"
class="c-header-brand mx-auto d-lg-none" class="mx-auto d-lg-none"
height="46" height="46"
src="img/brand/coreui-base.svg" src="img/brand/coreui-base.svg"
width="97" width="97"
wrappedinlink="[object Object]"
/> />
<cheadernav-stub <cheadernav-stub
@@ -119,12 +120,12 @@ exports[`TheHeader.vue renders correctly 1`] = `
<theheaderdropdownaccnt-stub /> <theheaderdropdownaccnt-stub />
</cheadernav-stub> </cheadernav-stub>
<div <csubheader
class="c-subheader px-3" class="px-3"
> >
<cbreadcrumbrouter-stub <cbreadcrumbrouter-stub
class="border-0" class="border-0"
/> />
</div> </csubheader>
</cheader-stub> </cheader-stub>
`; `;
@@ -10,8 +10,8 @@ exports[`TheSidebar.vue renders correctly 1`] = `
show="responsive" show="responsive"
> >
<csidebarbrand-stub <csidebarbrand-stub
fullsrc="img/brand/coreui-base-white.svg" imgfull="[object Object]"
minimizedsrc="img/brand/coreui-signet-white.svg" imgminimized="[object Object]"
wrappedinlink="[object Object]" wrappedinlink="[object Object]"
/> />
-16
View File
@@ -9,26 +9,10 @@ describe('Collapses.vue', () => {
it('has a name', () => { it('has a name', () => {
expect(Collapses.name).toBe('Collapses') expect(Collapses.name).toBe('Collapses')
}) })
it('has a created hook', () => {
expect(typeof Collapses.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Collapses.data).toMatch('function')
const defaultData = Collapses.data()
expect(defaultData.showCollapse).toBe(true)
})
it('is Vue instance', () => { it('is Vue instance', () => {
const wrapper = shallowMount(Collapses) const wrapper = shallowMount(Collapses)
expect(wrapper.isVueInstance()).toBe(true) expect(wrapper.isVueInstance()).toBe(true)
}) })
// it('is Collapses', () => {
// const wrapper = shallowMount(Collapses)
// expect(wrapper.is(Collapses)).toBe(true)
// })
// it('should render correct content', () => {
// const wrapper = mount(Collapses)
// expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Collapse')
// })
test('renders correctly', () => { test('renders correctly', () => {
const wrapper = mount(Collapses) const wrapper = mount(Collapses)
expect(wrapper.element).toMatchSnapshot() expect(wrapper.element).toMatchSnapshot()
@@ -54,7 +54,7 @@ exports[`Breadcrumbs.vue renders correctly 1`] = `
href="#" href="#"
target="_self" target="_self"
> >
&lt;b&gt;Admin&lt;/b&gt; Admin
</a> </a>
</li> </li>
<li <li
@@ -45,7 +45,6 @@ exports[`Collapses.vue renders correctly 1`] = `
> >
<button <button
class="btn btn-primary" class="btn btn-primary"
id="collapse1"
type="button" type="button"
> >
@@ -56,7 +55,6 @@ exports[`Collapses.vue renders correctly 1`] = `
<div <div
class="mt-2" class="mt-2"
style="display: none;" style="display: none;"
toggler="collapse1"
> >
<div <div
class="card" class="card"
@@ -73,7 +71,6 @@ exports[`Collapses.vue renders correctly 1`] = `
<button <button
class="btn btn-secondary btn-sm" class="btn btn-secondary btn-sm"
id="collapse2"
type="button" type="button"
> >
@@ -84,7 +81,6 @@ exports[`Collapses.vue renders correctly 1`] = `
<div <div
class="mt-2" class="mt-2"
style="display: none;" style="display: none;"
toggler="collapse2"
> >
<div <div
class="card" class="card"
@@ -38,10 +38,20 @@ exports[`Jumbotrons.vue renders correctly 1`] = `
<ccardbody-stub> <ccardbody-stub>
<cjumbotron-stub <cjumbotron-stub
header="Bootstrap 4"
lead="Bootstrap 4 Components for Vue.js 2"
tag="div" tag="div"
> >
<h1
class="display-3"
>
Bootstrap 4
</h1>
<p
class="lead"
>
Bootstrap 4 Components for Vue.js 2
</p>
<p> <p>
For more information visit website For more information visit website
</p> </p>
@@ -87,9 +97,14 @@ exports[`Jumbotrons.vue renders correctly 1`] = `
lead="" lead=""
tag="div" tag="div"
> >
<h1
class="display-3"
>
Bootstrap 4
</h1>
<p <p
class="lead" class="lead"
slot="lead"
> >
This is a simple hero unit, a simple jumbotron-style component for This is a simple hero unit, a simple jumbotron-style component for
@@ -164,13 +179,17 @@ exports[`Jumbotrons.vue renders correctly 1`] = `
<cjumbotron-stub <cjumbotron-stub
bordercolor="dark" bordercolor="dark"
color="info" color="info"
header="Bootstrap 4"
tag="div" tag="div"
textcolor="white" textcolor="white"
> >
<h1
class="display-3"
>
Bootstrap 4
</h1>
<p <p
class="lead" class="lead"
slot="lead"
> >
This is a simple hero unit, a simple jumbotron-style component for This is a simple hero unit, a simple jumbotron-style component for
@@ -286,11 +286,11 @@ exports[`Navbars.vue renders correctly 1`] = `
<cnavbarnav-stub <cnavbarnav-stub
tag="ul" tag="ul"
> >
<span <cnavbartext-stub
class="navbar-text" tag="div"
> >
Navbar text Navbar text
</span> </cnavbartext-stub>
</cnavbarnav-stub> </cnavbarnav-stub>
</ccollapse-stub> </ccollapse-stub>
</cnavbar-stub> </cnavbar-stub>
@@ -356,7 +356,25 @@ exports[`Alerts.vue renders correctly 1`] = `
class="alert-dismissible" class="alert-dismissible"
color="secondary" color="secondary"
show="true" show="true"
/> >
Dismissible Alert with custom button!
<cbutton-stub
activeclass="active"
class="position-absolute"
color="secondary"
event="click"
exactactiveclass="active"
routertag="a"
target="_self"
type="button"
>
Close
</cbutton-stub>
</calert-stub>
<cbutton-stub <cbutton-stub
activeclass="active" activeclass="active"