mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 19:21:07 +08:00
test fixes
This commit is contained in:
parent
2bd6aad28b
commit
fa7a82f331
@ -7,10 +7,7 @@ import BaseButton from '../components/BaseButton';
|
||||
import markdownNotes from './notes/notes.md';
|
||||
INSERT
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import BaseButton from '../components/BaseButton';
|
||||
import markdownNotes from './notes/notes.md';
|
||||
|
||||
const markdownString = '...';"
|
||||
`;
|
||||
@ -20,8 +17,7 @@ exports[`insertAfterImports imports 1`] = `
|
||||
import './bar';
|
||||
INSERT
|
||||
|
||||
import './foo';
|
||||
import './bar';
|
||||
|
||||
whatever;"
|
||||
`;
|
||||
|
||||
@ -32,10 +28,7 @@ import {
|
||||
} from 'baz';
|
||||
INSERT
|
||||
|
||||
import 'foo';
|
||||
import {
|
||||
bar
|
||||
} from 'baz';
|
||||
|
||||
whatever;"
|
||||
`;
|
||||
|
||||
@ -52,7 +45,6 @@ exports[`insertAfterImports single-line imports 1`] = `
|
||||
import { bar } from 'baz';
|
||||
INSERT
|
||||
|
||||
import 'foo';
|
||||
import { bar } from 'baz';
|
||||
|
||||
whatever;"
|
||||
`;
|
||||
|
@ -17,7 +17,7 @@ export function insertAfterImports(classLoader, insert, source) {
|
||||
if (!ast) return `${insert}${source}`;
|
||||
const endOfImportsIndex = endOfImports(ast);
|
||||
const result = `${source.substring(0, endOfImportsIndex)}\n${insert}\n${source.substring(
|
||||
endOfImportsIndex + 1
|
||||
endOfImportsIndex
|
||||
)}`;
|
||||
return result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user