提交 e7610b45 编写于 作者: H hdx

slider: 自动化测试使用id作为查询元素的标识

上级 625eb050
...@@ -8,7 +8,7 @@ describe('slider', () => { ...@@ -8,7 +8,7 @@ describe('slider', () => {
}) })
// it('change', async () => {}) // it('change', async () => {})
it('value', async () => { it('value', async () => {
const slider = await page.$('.slider-custom-color-and-size') const slider = await page.$('#slider-custom-color-and-size')
const sliderValue = 80 const sliderValue = 80
await page.setData({ await page.setData({
...@@ -20,7 +20,7 @@ describe('slider', () => { ...@@ -20,7 +20,7 @@ describe('slider', () => {
expect(newValue.toString()).toBe(sliderValue + '') expect(newValue.toString()).toBe(sliderValue + '')
}) })
it('color', async () => { it('color', async () => {
const slider = await page.$('.slider-custom-color-and-size') const slider = await page.$('#slider-custom-color-and-size')
expect(await slider.attribute('backgroundColor')).toBe('#000000') expect(await slider.attribute('backgroundColor')).toBe('#000000')
expect(await slider.attribute('activeColor')).toBe('#FFCC33') expect(await slider.attribute('activeColor')).toBe('#FFCC33')
expect(await slider.attribute('blockColor')).toBe('#8A6DE9') expect(await slider.attribute('blockColor')).toBe('#8A6DE9')
...@@ -40,7 +40,7 @@ describe('slider', () => { ...@@ -40,7 +40,7 @@ describe('slider', () => {
expect(await slider.attribute('blockColor')).toBe(blockColor) expect(await slider.attribute('blockColor')).toBe(blockColor)
}) })
it('block-size', async () => { it('block-size', async () => {
const slider = await page.$('.slider-custom-color-and-size') const slider = await page.$('#slider-custom-color-and-size')
expect(await slider.attribute('blockSize')).toBe(20 + '') expect(await slider.attribute('blockSize')).toBe(20 + '')
const blockSize = 18 const blockSize = 18
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
<view class="uni-title">不同颜色和大小的滑块</view> <view class="uni-title">不同颜色和大小的滑块</view>
<view> <view>
<slider class="slider-custom-color-and-size" @change="sliderChange" :value="sliderValue" <slider id="slider-custom-color-and-size" @change="sliderChange" :value="sliderValue"
:backgroundColor="sliderBackgroundColor" :activeColor="sliderActiveColor" :blockColor="sliderBlockColor" :backgroundColor="sliderBackgroundColor" :activeColor="sliderActiveColor" :blockColor="sliderBlockColor"
:block-size="sliderBlockSize" /> :block-size="sliderBlockSize" />
</view> </view>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册