Skip to content

Commit

Permalink
Add use-directory-name test
Browse files Browse the repository at this point in the history
This test case checks whether the "meaninglessFileNames" option is
applied properly to the "code.js" file and its parent directory name is
being used instead of its file name.
  • Loading branch information
MeLlamoPablo committed Nov 25, 2021
1 parent b99804c commit da023c4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/fixtures/use-directory-name/.babelrc
@@ -0,0 +1,12 @@
{
"plugins": [
[
"../../../src",
{
"meaninglessFileNames": ["code"],
"transpileTemplateLiterals": false,
"ssr": true
}
]
]
}
6 changes: 6 additions & 0 deletions test/fixtures/use-directory-name/code.js
@@ -0,0 +1,6 @@
import styled from "styled-components";

const Test = styled.div`color: red;`;
const before = styled.div`color: blue;`;
styled.div``;
export default styled.button``;
17 changes: 17 additions & 0 deletions test/fixtures/use-directory-name/output.js
@@ -0,0 +1,17 @@
import styled from "styled-components";
const Test = styled.div.withConfig({
displayName: "use-directory-name__Test",
componentId: "sc-193y009-0"
})`color:red;`;
const before = styled.div.withConfig({
displayName: "use-directory-name__before",
componentId: "sc-193y009-1"
})`color:blue;`;
styled.div.withConfig({
displayName: "use-directory-name",
componentId: "sc-193y009-2"
})``;
export default styled.button.withConfig({
displayName: "use-directory-name",
componentId: "sc-193y009-3"
})``;

0 comments on commit da023c4

Please sign in to comment.