feat(omi-cli): component template
This commit is contained in:
parent
e33ceb0c71
commit
1ea7175689
|
@ -13,6 +13,11 @@
|
|||
<body>
|
||||
<h1>HTML Mode</h1>
|
||||
<o-counter count="2"></o-counter>
|
||||
<script>
|
||||
document.querySelector('o-counter').addEventListener('CountChanged', function (evt) {
|
||||
console.log(evt.detail)
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -16,13 +16,16 @@
|
|||
"build": "vite build && yarn build:scss",
|
||||
"build:demo": "vite build",
|
||||
"build:scss": "sass src/index.scss src/index.css",
|
||||
"watch": "sass --watch src/index.scss src/index.css --no-source-map"
|
||||
"watch": "sass --watch src/index.scss src/index.css --no-source-map",
|
||||
"test": "web-test-runner \"test/*.js\" --node-resolve"
|
||||
},
|
||||
"dependencies": {
|
||||
"omi": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@open-wc/testing": "^2.5.33",
|
||||
"@types/node": "^16.4.7",
|
||||
"@web/test-runner": "^0.13.13",
|
||||
"node-watch": "^0.7.1",
|
||||
"sass": "^1.36.0",
|
||||
"typescript": "^4.3.2",
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import { html, fixture, expect } from '@open-wc/testing'
|
||||
|
||||
import '../dist/index.es.js'
|
||||
|
||||
|
||||
describe('o-counter ', () => {
|
||||
it('default prop', async () => {
|
||||
const el = await fixture(html`<o-counter></o-counter>`)
|
||||
expect(el.shadowRoot.innerHTML).to.equal(`<button>-</button><span>1</span><button>+</button>`)
|
||||
})
|
||||
|
||||
it('count prop', async () => {
|
||||
const el = await fixture(html`<o-counter count="2"></o-counter>`)
|
||||
expect(el.shadowRoot.innerHTML).to.equal(`<button>-</button><span>2</span><button>+</button>`)
|
||||
})
|
||||
|
||||
})
|
Loading…
Reference in New Issue