refactor(@omiu/step): rename to steps

This commit is contained in:
dntzhang 2021-08-09 09:43:44 +08:00
parent e355a95374
commit f66c88b98f
15 changed files with 50 additions and 50 deletions

View File

@ -1,18 +0,0 @@
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-step items="[
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'In Progress', description: 'This is a description.', state: 2 },
{ name: 'Waiting', description: 'This is a description.', state: 3 }
]" ></o-step>`)
expect(el.shadowRoot.innerHTML).to.equal(`<div class="o-step"><div class="_item _item-finish"><div class="_item-tail"></div><div class="_item-icon"><span class="icon"><i class="anticon anticon-check finish-icon"><o-icon-done></o-icon-done></i></span></div><div class="_item-content"><div class="_item-title">Finished</div><div class="_item-description">This is a description.</div></div></div><div class="_item _item-process"><div class="_item-tail"></div><div class="_item-icon"><span class="icon"><span class="icon">2</span></span></div><div class="_item-content"><div class="_item-title">In Progress</div><div class="_item-description">This is a description.</div></div></div><div class="_item _item-wait"><div class="_item-tail"></div><div class="_item-icon"><span class="icon"><span class="icon">3</span></span></div><div class="_item-content"><div class="_item-title">Waiting</div><div class="_item-description">This is a description.</div></div></div></div>`)
})
})

View File

@ -1,6 +1,6 @@
## Step
## Steps
> Step
> Steps
## Install

View File

@ -3,45 +3,45 @@
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<meta charset="UTF-8" >
<title>Omiu</title>
<script type="module" src="/src/index.tsx"></script>
<meta charset="UTF-8">
<title>Omiu</title>
<script type="module" src="/src/index.tsx"></script>
</head>
<body>
<h1>HTML Mode <a href="./demo.html">JSX Mode</a></h1>
<h1>HTML Mode <a href="./demo.html">JSX Mode</a></h1>
<div>
<o-step items="[
<o-steps items="[
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'In Progress', description: 'This is a description.', state: 2 },
{ name: 'Waiting', description: 'This is a description.', state: 3 }
]" ></o-step>
<o-step items="[
]"></o-steps>
<o-steps items="[
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'Error', description: 'This is a description.', state: 1 },
{ name: 'Waiting', description: 'This is a description.', state: 3 }
]" ></o-step>
<o-step items="[
]"></o-steps>
<o-steps items="[
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'Finished', description: 'This is a description.', state: 0 }
]" ></o-step>
]"></o-steps>
<o-step items="[
<o-steps items="[
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'In Progress', description: 'This is a description.', state: 2 },
{ name: 'Waiting', description: 'This is a description.', state: 3 }
]" vertical ></o-step>
<o-step items="[
]" vertical></o-steps>
<o-steps items="[
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'Error', description: 'This is a description.', state: 1 },
{ name: 'Waiting', description: 'This is a description.', state: 3 }
]" vertical ></o-step>
<o-step items="[
]" vertical></o-steps>
<o-steps items="[
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'Finished', description: 'This is a description.', state: 0 }
]" vertical ></o-step>
]" vertical></o-steps>
</div>
<script src="https://tencent.github.io/omi/packages/omi/dist/omi.js"></script>

View File

@ -1,5 +1,5 @@
{
"name": "@omiu/step",
"name": "@omiu/steps",
"version": "0.0.3",
"main": "dist/index.es.js",
"exports": {

View File

@ -32,13 +32,13 @@ define('my-app', class extends WeElement {
render() {
return (
<div>
<o-step items={this.itemsA} />
<o-step items={this.itemsB} />
<o-step items={this.itemsC} />
<o-steps items={this.itemsA} />
<o-steps items={this.itemsB} />
<o-steps items={this.itemsC} />
<o-step items={this.itemsA} vertical />
<o-step items={this.itemsB} vertical />
<o-step items={this.itemsC} vertical />
<o-steps items={this.itemsA} vertical />
<o-steps items={this.itemsB} vertical />
<o-steps items={this.itemsC} vertical />
</div>

View File

@ -2,13 +2,13 @@
display: block;
}
.o-step {
.o-steps {
width: 100%;
display: flex;
white-space: nowrap;
}
.o-step.vertical {
.o-steps.vertical {
flex-direction: column;
}

View File

@ -5,13 +5,13 @@
display: block;
}
.o-step {
.o-steps {
width: 100%;
display: flex;
white-space: nowrap;
}
.o-step.vertical{
.o-steps.vertical{
flex-direction: column;
}

View File

@ -12,8 +12,8 @@ const state = {
}
@tag('o-step')
export default class Step extends WeElement {
@tag('o-steps')
export default class Steps extends WeElement {
static css = css.default
static propTypes = {
@ -23,7 +23,7 @@ export default class Step extends WeElement {
render(props) {
return (
<div {...extractClass(props, 'o-step', {
<div {...extractClass(props, 'o-steps', {
'vertical': props.vertical
})}>
{props.items.map((item, index) => {

View File

@ -0,0 +1,18 @@
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-steps items="[
{ name: 'Finished', description: 'This is a description.', state: 0 },
{ name: 'In Progress', description: 'This is a description.', state: 2 },
{ name: 'Waiting', description: 'This is a description.', state: 3 }
]" ></o-steps>`)
expect(el.shadowRoot.innerHTML).to.equal(`<div class="o-steps"><div class="_item _item-finish"><div class="_item-tail"></div><div class="_item-icon"><span class="icon"><i class="anticon anticon-check finish-icon"><o-icon-done></o-icon-done></i></span></div><div class="_item-content"><div class="_item-title">Finished</div><div class="_item-description">This is a description.</div></div></div><div class="_item _item-process"><div class="_item-tail"></div><div class="_item-icon"><span class="icon"><span class="icon">2</span></span></div><div class="_item-content"><div class="_item-title">In Progress</div><div class="_item-description">This is a description.</div></div></div><div class="_item _item-wait"><div class="_item-tail"></div><div class="_item-icon"><span class="icon"><span class="icon">3</span></span></div><div class="_item-content"><div class="_item-title">Waiting</div><div class="_item-description">This is a description.</div></div></div></div>`)
})
})