mirror of https://github.com/alibaba/ice.git
				
				
				
			fix: importStyle test case (#471)
This commit is contained in:
		
							parent
							
								
									63fe64ee5b
								
							
						
					
					
						commit
						22931664a6
					
				| 
						 | 
					@ -5,7 +5,7 @@ describe('import style', () => {
 | 
				
			||||||
  it('simple import', async () => {
 | 
					  it('simple import', async () => {
 | 
				
			||||||
    const sourceCode = `import { Button } from 'antd';`;
 | 
					    const sourceCode = `import { Button } from 'antd';`;
 | 
				
			||||||
    const result = await importStyle(sourceCode, { libraryName: 'antd', style: true });
 | 
					    const result = await importStyle(sourceCode, { libraryName: 'antd', style: true });
 | 
				
			||||||
    expect(result?.code).toBe(`${sourceCode}\nimport 'antd/es/Button/style';`);
 | 
					    expect(result?.code).toBe(`${sourceCode}\nimport 'antd/es/button/style';`);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  it('custom style', async () => {
 | 
					  it('custom style', async () => {
 | 
				
			||||||
    const sourceCode = `import { Button } from 'antd';`;
 | 
					    const sourceCode = `import { Button } from 'antd';`;
 | 
				
			||||||
| 
						 | 
					@ -20,12 +20,12 @@ describe('import style', () => {
 | 
				
			||||||
  it('multiple import', async () => {
 | 
					  it('multiple import', async () => {
 | 
				
			||||||
    const sourceCode = `import { Button, Table } from 'antd';`;
 | 
					    const sourceCode = `import { Button, Table } from 'antd';`;
 | 
				
			||||||
    const result = await importStyle(sourceCode, { libraryName: 'antd', style: true });
 | 
					    const result = await importStyle(sourceCode, { libraryName: 'antd', style: true });
 | 
				
			||||||
    expect(result?.code).toBe(`${sourceCode}\nimport 'antd/es/Button/style';\nimport 'antd/es/Table/style';`);
 | 
					    expect(result?.code).toBe(`${sourceCode}\nimport 'antd/es/button/style';\nimport 'antd/es/table/style';`);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  it('named import', async () => {
 | 
					  it('named import', async () => {
 | 
				
			||||||
    const sourceCode = `import { Button as Btn } from 'antd';`;
 | 
					    const sourceCode = `import { Button as Btn } from 'antd';`;
 | 
				
			||||||
    const result = await importStyle(sourceCode, { libraryName: 'antd', style: true });
 | 
					    const result = await importStyle(sourceCode, { libraryName: 'antd', style: true });
 | 
				
			||||||
    expect(result?.code).toBe(`${sourceCode}\nimport 'antd/es/Button/style';`);
 | 
					    expect(result?.code).toBe(`${sourceCode}\nimport 'antd/es/button/style';`);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  it('default import', async () => {
 | 
					  it('default import', async () => {
 | 
				
			||||||
    const sourceCode = `import * as antd from 'antd';`;
 | 
					    const sourceCode = `import * as antd from 'antd';`;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue