Skip to content

Commit 3228bfc

Browse files
committed
test: add default language override test
1 parent 26888a5 commit 3228bfc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/autoProcess/autoProcess.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,26 @@ describe('options', () => {
164164
'potato<style>potato</style><script>potato</script>',
165165
);
166166
});
167+
168+
it.only('should respect lang/type attributes even if another default language is set', async () => {
169+
const input = `<script lang="tomatoScript">script</script>`;
170+
171+
const opts = getAutoPreprocess({
172+
defaults: {
173+
script: 'potatoScript',
174+
},
175+
potatoScript({ content }) {
176+
return { code: content.replace('script', 'potato') };
177+
},
178+
tomatoScript({ content }) {
179+
return { code: content.replace('script', 'tomato') };
180+
},
181+
});
182+
183+
const preprocessed = await preprocess(input, opts);
184+
185+
expect(preprocessed.toString()).toContain(
186+
'<script lang="tomatoScript">tomato</script>',
187+
);
188+
});
167189
});

0 commit comments

Comments
 (0)