mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
test: add prop
This commit is contained in:
parent
0187df7225
commit
50cbfba5a1
|
@ -18,4 +18,12 @@ describe('CanvasHandleRectangle', () => {
|
||||||
|
|
||||||
expect(wrapper.container.querySelector(`.${customClass}`)).toBeTruthy();
|
expect(wrapper.container.querySelector(`.${customClass}`)).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should apply sourceEdgeHovered prop correctly', () => {
|
||||||
|
const wrapper = renderComponent({
|
||||||
|
props: { sourceEdgeHovered: true },
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.container.querySelector('.rectangle--hovered')).toBeTruthy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
withDefaults(
|
import { computed, useCssModule } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
handleClasses?: string;
|
handleClasses?: string;
|
||||||
sourceEdgeHovered: boolean;
|
sourceEdgeHovered: boolean;
|
||||||
|
@ -8,16 +10,18 @@ withDefaults(
|
||||||
handleClasses: undefined,
|
handleClasses: undefined,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const $style = useCssModule();
|
||||||
|
|
||||||
|
const classes = computed(() => [
|
||||||
|
$style.rectangle,
|
||||||
|
props.handleClasses,
|
||||||
|
...(props.sourceEdgeHovered ? [$style['rectangle--hovered']] : []),
|
||||||
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div :class="classes" />
|
||||||
:class="{
|
|
||||||
[$style.rectangle]: true,
|
|
||||||
handleClasses,
|
|
||||||
[$style['rectangle--hovered']]: sourceEdgeHovered,
|
|
||||||
}"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
|
|
Loading…
Reference in a new issue