diff --git a/pages.json b/pages.json index c2afa5841e6c0ad771a9a1eccbee8dd321663759..1cc5043ee7498559475e3c05d98db6cb58227008 100644 --- a/pages.json +++ b/pages.json @@ -68,6 +68,12 @@ "navigationBarTitleText": "slider" } }, + { + "path": "pages/component/picker-view/picker-view", + "style": { + "navigationBarTitleText": "picker-view" + } + }, { "path": "pages/component/slider-100/slider-100", "style": { diff --git a/pages/component/picker-view/picker-view.test.js b/pages/component/picker-view/picker-view.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0f860c6b4b9f92f1e74601bb86377bd2d1f99f19 --- /dev/null +++ b/pages/component/picker-view/picker-view.test.js @@ -0,0 +1,58 @@ +function getData(key = '') { + return new Promise(async (resolve, reject) => { + const data = await page.data() + resolve(key ? data[key] : data) + }) +} + +let page +beforeAll(async () => { + page = await program.reLaunch('/pages/component/picker-view/picker-view') + await page.waitFor(1000) +}) + +describe('PickerView.uvue', () => { + it('value', async () => { + const el = await page.$('.picker-view') + await page.callMethod('setValue') + await page.waitFor(1000) + expect(await el.property('value')).toEqual([0, 0, 0]) + expect(await getData('result')).toEqual([0, 0, 0]) + + await page.callMethod('setValue1') + await page.waitFor(1000) + expect(await el.property('value')).toEqual([10, 10, 10]) + expect(await getData('result')).toEqual([10, 10, 10]) + }) + + it('length', async () => { + const els = await page.$$('.picker-view') + expect(els.length).toBe(1) + const els1 = await page.$$('.picker-view-column') + expect(els1.length).toBe(3) + }) + it('indicator-style', async () => { + const el = await page.$('.picker-view') + await page.setData({ + indicatorStyle: 'height: 100px;' + }) + await page.waitFor(500) + expect(await el.property('indicatorStyle')).toBe('height: 100px;') + }) + it('mask-top-style', async () => { + const el = await page.$('.picker-view') + await page.setData({ + maskTopStyle: 'background: #ffffff;' + }) + await page.waitFor(500) + expect(await el.property('mask-top-style')).toBe('background: #ffffff;') + }) + it('mask-bottom-style', async () => { + const el = await page.$('.picker-view') + await page.setData({ + maskBottomStyle: 'background: #ffffff;' + }) + await page.waitFor(500) + expect(await el.property('mask-bottom-style')).toBe('background: #ffffff;') + }) +}) \ No newline at end of file diff --git a/pages/component/picker-view/picker-view.uvue b/pages/component/picker-view/picker-view.uvue new file mode 100644 index 0000000000000000000000000000000000000000..2ec05202370562c5df5115694a906762605fc066 --- /dev/null +++ b/pages/component/picker-view/picker-view.uvue @@ -0,0 +1,92 @@ + + + + + \ No newline at end of file diff --git a/pages/tabBar/component.uvue b/pages/tabBar/component.uvue index da0baaad91fb9f930a225f200b6f575be9811460..3143b7090e0f48440b94f6d8893ce9a4ee713cbe 100644 --- a/pages/tabBar/component.uvue +++ b/pages/tabBar/component.uvue @@ -115,8 +115,7 @@ name: 'picker', enable: false */ }, { - name: 'picker-view', - enable: false + name: 'picker-view' }, { name: 'radio', }, {