-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
255 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
resources/ts/admin-area/components/AppNavbarTreeToggleBtn.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template lang="pug"> | ||
a.btn.btn-outline-success(@click="clickHandler") | ||
img(src='/img/admin-area/icons/folding.svg') | ||
img.toggle(:src="imageUrl") | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
export default defineComponent({ | ||
name: "AppNavbarTreeToggleBtn", | ||
data () { | ||
return { | ||
open: false | ||
} | ||
}, | ||
computed: { | ||
imageUrl (): string { | ||
let imageName = this.open ? 'minus' : 'plus' | ||
return `/img/admin-area/icons/${imageName}.svg` | ||
} | ||
}, | ||
methods: { | ||
clickHandler (): void { | ||
this.open = !this.open | ||
} | ||
}, | ||
}) | ||
</script> | ||
|
||
<style lang="sass" scoped> | ||
.btn-outline-success | ||
background-color: #fff | ||
border-color: #a5e3e2 | ||
&:hover | ||
background-color: #9cfffa | ||
.toggle | ||
margin-left: .4em | ||
</style> |
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
resources/ts/admin-area/components/__tests__/AppNavbarTreeToggleBtn.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import AppNavbarTreeToggleBtn from '../AppNavbarTreeToggleBtn.vue' | ||
|
||
describe('AppNavbarTreeToggleBtn.vue', () => { | ||
it('test img src plus/minus', async () => { | ||
const wrapper = shallowMount(AppNavbarTreeToggleBtn) | ||
const button = wrapper.find('.btn-outline-success') | ||
|
||
let image = wrapper.find('img.toggle') | ||
let src = image.attributes('src') | ||
let file = src.substring(src.lastIndexOf('/')+1) | ||
|
||
expect(file).toMatch(/plus/); | ||
|
||
await button.trigger('click') | ||
|
||
src = image.attributes('src') | ||
file = src.substring(src.lastIndexOf('/')+1) | ||
|
||
expect(file).toMatch(/minus/); | ||
|
||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
declare module '*.vue' { | ||
import type { DefineComponent } from 'vue' | ||
const component: DefineComponent<{}, {}, any> | ||
export default component | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters