Skip to content

Commit

Permalink
fix: fix KMenu component with is not correct in vertical mode (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
baiwusanyu-c authored Jan 24, 2025
1 parent 9f944c6 commit 4bcfbef
Show file tree
Hide file tree
Showing 21 changed files with 297 additions and 438 deletions.

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions components/Calendar/__test__/calendar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('Test: KCalendar', () => {
expect(cells.length).toBe(12);
let cellS = host.querySelector('.k-calendar-date-s');
expect(cellS.innerHTML).matchSnapshot();
const monthBtn = host.querySelectorAll('button')[1];
const monthBtn = host.querySelectorAll('button')[0];
expect(monthBtn.innerHTML.includes('Year')).toBeTruthy();
monthBtn.click();
await tick();
Expand All @@ -141,7 +141,7 @@ describe('Test: KCalendar', () => {
trigger.click();
await tick();
expect(test.innerHTML).toBe('2024-04-25');
const monthBtn = host.querySelectorAll('button')[3];
const monthBtn = host.querySelectorAll('button')[1];
monthBtn.click();
await tick();
const trMonth = host.querySelector('[title="2024-06"]');
Expand All @@ -166,7 +166,7 @@ describe('Test: KCalendar', () => {
expect(opContainer.children.length).toBe(1);
expect(opContainer.children[0].innerHTML.includes('2024')).toBeTruthy();

const yearBtn = host.querySelectorAll('button')[1];
const yearBtn = host.querySelectorAll('button')[0];
expect(yearBtn.innerHTML.includes('Year')).toBeTruthy();
yearBtn.click();
await tick();
Expand Down Expand Up @@ -258,13 +258,13 @@ describe('Test: KCalendar', () => {
mockFn();
});

const btn1 = host.querySelectorAll('button')[2];
const btn1 = host.querySelectorAll('button')[0];
btn1.click();
await tick();
expect(mockFn).toBeCalledTimes(1);
expect(data).matchSnapshot();

const btn2 = host.querySelectorAll('button')[3];
const btn2 = host.querySelectorAll('button')[1];
btn2.click();
await tick();
expect(mockFn).toBeCalledTimes(2);
Expand Down

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions components/Dropdown/__test__/__snapshots__/dropdown.spec.ts.snap

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions components/Ellipsis/__test__/__snapshots__/ellipsis.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Test: KEllipsis > props: cls 1`] = `"<button class="k-popover--trigger svelte-13arsd0" data-popover-trigger=""><button class="k-ellipsis k-ellipsis--test" slot="triggerEl" style="">...</button></button> "`;
exports[`Test: KEllipsis > props: cls 1`] = `"<div class="k-popover--trigger svelte-13arsd0" role="button" tabindex="-1" data-popover-trigger=""><button class="k-ellipsis k-ellipsis--test" slot="triggerEl" style="">...</button></div> "`;

exports[`Test: KEllipsis > props: content 1`] = `"<button class="k-popover--trigger svelte-13arsd0" data-popover-trigger=""><button class="k-ellipsis" slot="triggerEl" style="">我言秋日胜春朝</button></button> <div role="tooltip" class="k-popover--base k-popover--base__top k-popover--base__top__dark k-popover--base__dark svelte-13arsd0" data-popper-placement="" style="animation: __svelte_767937530_0 300ms linear 0ms 1 both; position: absolute; left: 0px; top: -8px;"><span slot="contentEl">自古逢秋悲寂寥</span> <div k-popover-arrow="true" data-popper-arrow-bottom="" data-popper-arrow-top="" data-popper-arrow-right="" data-popper-arrow-left="" class="svelte-13arsd0"></div></div>"`;
exports[`Test: KEllipsis > props: content 1`] = `"<div class="k-popover--trigger svelte-13arsd0" role="button" tabindex="-1" data-popover-trigger=""><button class="k-ellipsis" slot="triggerEl" style="">我言秋日胜春朝</button></div> <div role="tooltip" class="k-popover--base k-popover--base__top k-popover--base__top__dark k-popover--base__dark svelte-13arsd0" data-popper-placement="" style="animation: __svelte_767937530_0 300ms linear 0ms 1 both; position: absolute; left: 0px; top: -8px;"><span slot="contentEl">自古逢秋悲寂寥</span> <div k-popover-arrow="true" data-popper-arrow-bottom="" data-popper-arrow-top="" data-popper-arrow-right="" data-popper-arrow-left="" class="svelte-13arsd0"></div></div>"`;

exports[`Test: KEllipsis > props: expand 1`] = `"<button class="k-popover--trigger svelte-13arsd0" data-popover-trigger=""><button class="k-ellipsis--line-clamp" slot="triggerEl" style="-webkit-line-clamp: 3; display: -webkit-inline-box; overflow: hidden;">我言秋日...</button></button> "`;
exports[`Test: KEllipsis > props: expand 1`] = `"<div class="k-popover--trigger svelte-13arsd0" role="button" tabindex="-1" data-popover-trigger=""><button class="k-ellipsis--line-clamp" slot="triggerEl" style="-webkit-line-clamp: 3; display: -webkit-inline-box; overflow: hidden;">我言秋日...</button></div> "`;

exports[`Test: KEllipsis > props: num 1`] = `"<button class="k-popover--trigger svelte-13arsd0" data-popover-trigger=""><button class="k-ellipsis" slot="triggerEl" style="">我言秋日...</button></button> "`;
exports[`Test: KEllipsis > props: num 1`] = `"<div class="k-popover--trigger svelte-13arsd0" role="button" tabindex="-1" data-popover-trigger=""><button class="k-ellipsis" slot="triggerEl" style="">我言秋日...</button></div> "`;

exports[`Test: KEllipsis > props: text 1`] = `"<button class="k-popover--trigger svelte-13arsd0" data-popover-trigger=""><button class="k-ellipsis" slot="triggerEl" style="">我言秋日胜春朝</button></button> "`;
exports[`Test: KEllipsis > props: text 1`] = `"<div class="k-popover--trigger svelte-13arsd0" role="button" tabindex="-1" data-popover-trigger=""><button class="k-ellipsis" slot="triggerEl" style="">我言秋日胜春朝</button></div> "`;
2 changes: 1 addition & 1 deletion components/Form/__test__/__snapshots__/form.spec.ts.snap

Large diffs are not rendered by default.

160 changes: 80 additions & 80 deletions components/Menu/__test__/__snapshots__/menu.spec.ts.snap

Large diffs are not rendered by default.

Loading

0 comments on commit 4bcfbef

Please sign in to comment.