fix(editor): Fix success status for plus stalk on new canvas (no-changelog) (#11140)
Some checks failed
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Has been cancelled

This commit is contained in:
Alex Grozav 2024-10-07 16:57:45 +03:00 committed by GitHub
parent 41228b472d
commit 6522b1cc44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 7 deletions

View file

@ -32,6 +32,23 @@ describe('CanvasHandleMainOutput', () => {
expect(queryByTestId('canvas-handle-plus')).not.toBeInTheDocument();
});
it('should render CanvasHandlePlus with success state when runData.total > 1', () => {
const { queryByTestId } = renderComponent({
global: {
provide: {
...createCanvasHandleProvide({
runData: {
total: 2,
iterations: 1,
},
}),
},
},
});
expect(queryByTestId('canvas-handle-plus')).toHaveClass('success');
});
it('should render run data label', async () => {
const runData = {
total: 1,

View file

@ -38,7 +38,7 @@ const runDataLabel = computed(() =>
const isHandlePlusVisible = computed(() => !isConnecting.value || isHovered.value);
const plusType = computed(() => (runData.value ? 'success' : 'default'));
const plusType = computed(() => ((runData.value?.total ?? 0) > 0 ? 'success' : 'default'));
const plusLineSize = computed(
() =>

View file

@ -10,7 +10,7 @@ const emit = defineEmits<{
const $style = useCssModule();
const { label, isConnected, isConnecting, isRequired, type, runData } = useCanvasNodeHandle();
const { label, isConnected, isConnecting, isRequired, type } = useCanvasNodeHandle();
const handleClasses = 'target';
@ -30,8 +30,6 @@ const isHandlePlusVisible = computed(
() => !isConnecting.value || isHovered.value || supportsMultipleConnections.value,
);
const plusType = computed(() => (runData.value ? 'success' : 'ai'));
const isHovered = ref(false);
function onMouseEnter() {
@ -55,7 +53,7 @@ function onClickAdd() {
v-if="isHandlePlusAvailable"
v-show="isHandlePlusVisible"
:handle-classes="handleClasses"
:type="plusType"
type="secondary"
position="bottom"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"

View file

@ -7,7 +7,7 @@ const props = withDefaults(
handleClasses?: string;
plusSize?: number;
lineSize?: number;
type?: 'success' | 'ai' | 'default';
type?: 'success' | 'secondary' | 'default';
}>(),
{
position: 'right',
@ -135,7 +135,7 @@ function onClick(event: MouseEvent) {
.wrapper {
position: relative;
&.ai {
&.secondary {
.line {
stroke: var(--node-type-supplemental-color);
}