Skip to content

Commit ca7a3c3

Browse files
committed
Update tests and command
1 parent 79ec251 commit ca7a3c3

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint:eslint-docs": "npm run update:eslint-docs -- --check",
1616
"lint:js": "eslint .",
1717
"pretest": "mkdir -p node_modules/ && ln -fs $(pwd) node_modules/",
18-
"test": "npm run eslint-check && npm run lint && mocha tests/**/*.js tests/",
18+
"test": "npm run eslint-check && npm run lint && mocha tests/**/*.js tests/**/*.mjs",
1919
"update:eslint-docs": "eslint-doc-generator"
2020
},
2121
"repository": {

tests/utils/get-element-type.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,15 @@ describe('getElementType', function () {
6363
])
6464
expect(getElementType({}, node)).to.equal('Box')
6565
})
66+
67+
it('returns raw type when polymorphic prop is set to component, and not the mapped value', function () {
68+
// <Box as={Link} />
69+
const setting = mockSetting({
70+
Box: 'div',
71+
})
72+
73+
// eslint-disable-next-line no-undef
74+
const node = mockJSXOpeningElement('Box', [mockJSXAttribute('as', Link)])
75+
expect(getElementType(setting, node)).to.equal('Box')
76+
})
6677
})

0 commit comments

Comments
 (0)