Skip to content

Commit

Permalink
fix: data-test test
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume60240 committed Sep 9, 2024
1 parent fb6ce54 commit 08330ef
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions packages/components/sortable-list/test/sortable-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,25 @@ describe('SortableList tests', () => {

it('should handle dataTest prop correctly', () => {
const list = [
// with iconPosition right
{
id: '1',
title: 'Item 1',
description: 'Description',
imgSrc: 'https://t.ly/Ku50h',
iconPosition: 'right'
},
// with iconPosition left
{ id: '2', title: 'Item 2', iconPosition: 'left' }
{ id: '2', title: 'Item 2' }
];
const dataTest = 'sortable-list-test';

factory({ listId: 'test', list, itemKey: 'id', dataTest });
factory({
listId: 'test',
list,
itemKey: 'id',
dataTest,
iconPosition: 'right'
});
expect(wrapper.attributes('data-test')).toBe(dataTest);
// item 1
expect(wrapper.find(`[data-test="${dataTest}-item-1"]`).exists()).toBe(
true
);
Expand All @@ -182,8 +185,16 @@ describe('SortableList tests', () => {
expect(
wrapper.find(`[data-test="${dataTest}-right-icon-1"]`).exists()
).toBe(true);
// item 2
expect(wrapper.find(`[data-test="${dataTest}-left-icon-2"]`).exists()).toBe(

// Test iconPosition left
factory({
listId: 'test',
list,
itemKey: 'id',
dataTest,
iconPosition: 'left'
});
expect(wrapper.find(`[data-test="${dataTest}-left-icon-1"]`).exists()).toBe(
true
);
});
Expand Down

0 comments on commit 08330ef

Please sign in to comment.