mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 14:01:20 +08:00
test(core): init stencil core test suite
This commit is contained in:
3012
packages/core/package-lock.json
generated
3012
packages/core/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,10 +10,12 @@
|
|||||||
"dist/"
|
"dist/"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@stencil/core": "0.0.6-0",
|
"@stencil/core": "0.0.6-2",
|
||||||
"@stencil/dev-server": "latest",
|
"@stencil/dev-server": "latest",
|
||||||
"@stencil/utils": "latest",
|
"@stencil/utils": "latest",
|
||||||
|
"@types/jest": "^21.1.0",
|
||||||
"ionicons": "^4.0.0-6",
|
"ionicons": "^4.0.0-6",
|
||||||
|
"jest": "^21.1.0",
|
||||||
"sass-lint": "^1.11.1",
|
"sass-lint": "^1.11.1",
|
||||||
"tslint": "^5.7.0",
|
"tslint": "^5.7.0",
|
||||||
"tslint-ionic-rules": "0.0.11"
|
"tslint-ionic-rules": "0.0.11"
|
||||||
@ -22,6 +24,7 @@
|
|||||||
"build": "stencil build",
|
"build": "stencil build",
|
||||||
"dev": "sd concurrent \"stencil build --dev --watch\" \"stencil-dev-server\"",
|
"dev": "sd concurrent \"stencil build --dev --watch\" \"stencil-dev-server\"",
|
||||||
"test": "jest --no-cache",
|
"test": "jest --no-cache",
|
||||||
|
"test.watch": "jest --watch --no-cache",
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"lint": "npm run tslint",
|
"lint": "npm run tslint",
|
||||||
"sass-lint": "sass-lint -v -q",
|
"sass-lint": "sass-lint -v -q",
|
||||||
@ -40,5 +43,17 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/ionic-team/ionic/issues"
|
"url": "https://github.com/ionic-team/ionic/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/ionic-team/ionic#readme"
|
"homepage": "https://github.com/ionic-team/ionic#readme",
|
||||||
|
"jest": {
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.(ts|tsx)$": "<rootDir>/node_modules/@stencil/core/testing/jest.preprocessor.js"
|
||||||
|
},
|
||||||
|
"testRegex": ".*\\.spec\\.(ts|tsx|js)$",
|
||||||
|
"moduleFileExtensions": [
|
||||||
|
"ts",
|
||||||
|
"tsx",
|
||||||
|
"js",
|
||||||
|
"jsx"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
27
packages/core/src/components/button/test/button.spec.ts
Normal file
27
packages/core/src/components/button/test/button.spec.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { render, flush } from '@stencil/core/testing';
|
||||||
|
import { Button } from '../button';
|
||||||
|
|
||||||
|
|
||||||
|
describe('button', () => {
|
||||||
|
|
||||||
|
it('should render button inner text', async () => {
|
||||||
|
const root = await render({
|
||||||
|
components: [Button],
|
||||||
|
html: '<ion-button>Button Inner Text</ion-button>'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(root.textContent).toBe('Button Inner Text');
|
||||||
|
expect(root.querySelector('button').hasAttribute('disabled')).toBe(false);
|
||||||
|
|
||||||
|
root.disabled = true;
|
||||||
|
await flush(root);
|
||||||
|
|
||||||
|
expect(root.querySelector('button').hasAttribute('disabled')).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should default itemButton to false', () => {
|
||||||
|
const btn = new Button();
|
||||||
|
expect(btn.itemButton).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
Reference in New Issue
Block a user