-
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.
Merge pull request #147 from Geoportail-Luxembourg/GSLUX-733-point-sy…
…mbole GSLUX-733: Symbols
- Loading branch information
Showing
38 changed files
with
683 additions
and
150 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
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 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 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 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 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
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,64 @@ | ||
import { mount } from '@vue/test-utils' | ||
import RangeInput from './range-input.vue' | ||
|
||
describe('RangeInput', () => { | ||
it('renders with default props', () => { | ||
const wrapper = mount(RangeInput) | ||
const rangeInput = wrapper.find('input[type="range"]') | ||
const numberInput = wrapper.find('input[type="number"]') | ||
|
||
expect(rangeInput.element.value).toBe('0') | ||
expect(rangeInput.element.min).toBe('0') | ||
expect(rangeInput.element.max).toBe('10') | ||
expect(rangeInput.element.step).toBe('1') | ||
|
||
expect(numberInput.element.value).toBe('0') | ||
expect(numberInput.element.min).toBe('0') | ||
expect(numberInput.element.max).toBe('10') | ||
expect(numberInput.element.step).toBe('1') | ||
}) | ||
|
||
it('renders with passed props', () => { | ||
const wrapper = mount(RangeInput, { | ||
props: { | ||
min: 5, | ||
max: 20, | ||
step: 2, | ||
value: 10, | ||
}, | ||
}) | ||
const rangeInput = wrapper.find('input[type="range"]') | ||
const numberInput = wrapper.find('input[type="number"]') | ||
|
||
expect(rangeInput.element.value).toBe('10') | ||
expect(rangeInput.element.min).toBe('5') | ||
expect(rangeInput.element.max).toBe('20') | ||
expect(rangeInput.element.step).toBe('2') | ||
|
||
expect(numberInput.element.value).toBe('10') | ||
expect(numberInput.element.min).toBe('5') | ||
expect(numberInput.element.max).toBe('20') | ||
expect(numberInput.element.step).toBe('2') | ||
}) | ||
|
||
it('updates value when input changes', async () => { | ||
const wrapper = mount(RangeInput) | ||
const rangeInput = wrapper.find('input[type="range"]') | ||
const numberInput = wrapper.find('input[type="number"]') | ||
|
||
await rangeInput.setValue('5') | ||
expect(numberInput.element.value).toBe('5') | ||
|
||
await numberInput.setValue('7') | ||
expect(rangeInput.element.value).toBe('7') | ||
}) | ||
|
||
it('emits change event with correct value', async () => { | ||
const wrapper = mount(RangeInput) | ||
const numberInput = wrapper.find('input[type="number"]') | ||
|
||
await numberInput.setValue('5') | ||
expect(wrapper.emitted('change')).toHaveLength(1) | ||
expect(wrapper.emitted('change')?.[0]).toEqual([5]) | ||
}) | ||
}) |
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,42 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
const props = withDefaults( | ||
defineProps<{ | ||
min?: number | ||
max?: number | ||
step?: number | ||
value?: number | ||
}>(), | ||
{ | ||
min: 0, | ||
max: 10, | ||
step: 1, | ||
value: 0, | ||
} | ||
) | ||
defineEmits(['change']) | ||
const inputValue = ref(props.value) | ||
</script> | ||
|
||
<template> | ||
<div class="flex"> | ||
<input | ||
type="range" | ||
class="m-2.5 w-16 h-[5px] rounded-lg appearance-none cursor-pointer" | ||
:min="min" | ||
:max="max" | ||
:step="step" | ||
v-model="inputValue" | ||
/> | ||
<input | ||
type="number" | ||
class="w-12" | ||
:min="min" | ||
:max="max" | ||
:step="step" | ||
v-model="inputValue" | ||
@change="$emit('change', inputValue)" | ||
/> | ||
</div> | ||
</template> |
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,19 @@ | ||
<script setup lang="ts"> | ||
const props = withDefaults( | ||
defineProps<{ | ||
radius?: number | ||
fillColor?: string | ||
}>(), | ||
{ | ||
radius: 9, | ||
fillColor: 'red', | ||
} | ||
) | ||
const size = props.radius * 2 | ||
</script> | ||
|
||
<template> | ||
<svg :height="size" :width="size"> | ||
<circle :cx="radius" :cy="radius" :r="radius" :fill="fillColor" /> | ||
</svg> | ||
</template> |
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,22 @@ | ||
<script setup lang="ts"> | ||
withDefaults( | ||
defineProps<{ | ||
fillColor?: string | ||
fontSize?: number | ||
height?: number | ||
width?: number | ||
}>(), | ||
{ | ||
fillColor: 'red', | ||
fontSize: 42, | ||
height: 18, | ||
width: 18, | ||
} | ||
) | ||
</script> | ||
|
||
<template> | ||
<svg :height="height" :width="width"> | ||
<text x="1" :y="height + 2" :font-size="fontSize" :fill="fillColor">+</text> | ||
</svg> | ||
</template> |
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,20 @@ | ||
<script setup lang="ts"> | ||
withDefaults( | ||
defineProps<{ | ||
fillColor?: string | ||
height?: number | ||
width?: number | ||
}>(), | ||
{ | ||
fillColor: 'red', | ||
height: 18, | ||
width: 18, | ||
} | ||
) | ||
</script> | ||
|
||
<template> | ||
<svg :height="height" :width="width"> | ||
<rect height="100%" width="100%" :fill="fillColor" /> | ||
</svg> | ||
</template> |
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,20 @@ | ||
<script setup lang="ts"> | ||
const props = withDefaults( | ||
defineProps<{ | ||
fillColor?: string | ||
size?: number | ||
}>(), | ||
{ | ||
fillColor: 'red', | ||
size: 18, | ||
} | ||
) | ||
const top = props.size / 2 | ||
const points = `0,${props.size} ${top},0 ${props.size},${props.size}` | ||
</script> | ||
|
||
<template> | ||
<svg :height="size" :width="size"> | ||
<polygon :points="points" :fill="fillColor"></polygon> | ||
</svg> | ||
</template> |
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
Oops, something went wrong.