| undefined>(
switch (intent.payload.operation) {
case 'append':
case 'prepend':
+ case 'insert':
case 'replace':
return updateList(list, {
...intent.payload,
diff --git a/playground/app/routes/simple-list.tsx b/playground/app/routes/simple-list.tsx
index d3a495fb..efe79fd7 100644
--- a/playground/app/routes/simple-list.tsx
+++ b/playground/app/routes/simple-list.tsx
@@ -84,13 +84,13 @@ export default function SimpleList() {
diff --git a/playwright.config.ts b/playwright.config.ts
index dc9a28a5..28a59f62 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -40,6 +40,8 @@ const config: PlaywrightTestConfig = {
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
+ /* Take screenshot on testrun failure. */
+ screenshot: 'only-on-failure',
},
/* Configure projects for major browsers */
diff --git a/tests/conform-dom.spec.ts b/tests/conform-dom.spec.ts
index 673da063..4166c4f3 100644
--- a/tests/conform-dom.spec.ts
+++ b/tests/conform-dom.spec.ts
@@ -143,7 +143,7 @@ test.describe('conform-dom', () => {
error: {},
};
- const intent1 = list.prepend('tasks');
+ const intent1 = list.insert('tasks', { index: 0 });
expect(
parse(createFormData([...entries, [intent1.name, intent1.value]])),
@@ -155,8 +155,9 @@ test.describe('conform-dom', () => {
},
});
- const intent2 = list.prepend('tasks', {
+ const intent2 = list.insert('tasks', {
defaultValue: { content: 'Something' },
+ index: 0,
});
expect(
@@ -169,7 +170,7 @@ test.describe('conform-dom', () => {
},
});
- const intent3 = list.append('tasks');
+ const intent3 = list.insert('tasks');
expect(
parse(createFormData([...entries, [intent3.name, intent3.value]])),
@@ -181,7 +182,7 @@ test.describe('conform-dom', () => {
},
});
- const intent4 = list.append('tasks', {
+ const intent4 = list.insert('tasks', {
defaultValue: { content: 'Something' },
});
@@ -343,6 +344,20 @@ test.describe('conform-dom', () => {
defaultValue: 'testing/seperator',
},
});
+ expect(
+ parseIntent(
+ list.insert('tasks', { index: 3, defaultValue: 'testing/seperator' })
+ .value,
+ ),
+ ).toEqual({
+ type: 'list',
+ payload: {
+ name: 'tasks',
+ operation: 'insert',
+ defaultValue: 'testing/seperator',
+ index: 3,
+ },
+ });
expect(parseIntent(list.remove('tasks', { index: 0 }).value)).toEqual({
type: 'list',
payload: {