Skip to content

Commit

Permalink
upd: v2.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
richard1015 committed May 25, 2020
1 parent 65fb30b commit 420ecdd
Show file tree
Hide file tree
Showing 62 changed files with 1,676 additions and 1,422 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"printWidth": 150,
"useTabs": false,
"htmlWhitespaceSensitivity": "strict"
}
}
35 changes: 0 additions & 35 deletions .vscode/settings.json

This file was deleted.

18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 2.2.5

`2020-05-25`

* :sparkles: feat(Address):新增地址组件 @yangxiaolu1993
* :sparkles: upd(Popup):优化内部代码、单元测试 @yangkaixuan
* :sparkles: upd(LeftSlip):重构优化代码 #229 @vickyYE
* :sparkles: upd(Video):修复自定义蒙层 @vickyYE
* :sparkles: upd(Tab):优化内部代码,支持多页签滑动 @zhenyulei
* :bug: fix(Range):stage 失效、控制器重叠问题 #242 @undo03
* :bug: fix(CountDown):修复 startTime 异步更新问题 @undo03
* :bug: fix(Icon):修复 url 异步更新问题 @richard1015
* :bug: fix(Swiper):修复 cdn 模式下 event 事件失效问题 @richard1015
* :bug: fix(Dialog):修复标签使用时,取消按钮无效 @guoxiao158
* :zap: doc:nutui-demo、user-case jdf2e 地址库更换 @richard1015
* :zap: doc:补充 rate js 文档 @richard1015
* :zap: doc:补充 switch demo 文档 @zjyau

## 2.2.4

`2020-04-29`
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nutui/nutui",
"version": "2.2.4",
"version": "2.2.5",
"description": "一套轻量级移动端Vue组件库",
"typings": "dist/types/index.d.ts",
"main": "dist/nutui.js",
Expand All @@ -21,8 +21,8 @@
"test": "cross-env NODE_ENV=test nyc mocha-webpack --webpack-config node_modules/@nutui/cli/dist_cli/webpack/test.config.js --require node_modules/@nutui/cli/dist_cli/test/setup.js src/packages/*/__test__/**.spec.js",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"test:watch": "npm run test --watch",
"prettier:check": "prettier -l {lib,src}/**/**/*.{ts,js,vue,scss}",
"prettier:fix": "prettier --write {lib,src}/**/**/*.{ts,js,vue,scss}"
"prettier:check": "prettier -l src/**/*.{ts,js,vue,scss}",
"prettier:fix": "prettier --write src/**/*.{ts,js,vue,scss}"
},
"repository": {
"type": "git",
Expand Down
12 changes: 10 additions & 2 deletions src/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"sorts": ["数据展示", "数据录入", "操作反馈", "导航组件", "布局组件", "基础组件", "业务组件"],
"sorts": [
"数据展示",
"数据录入",
"操作反馈",
"导航组件",
"布局组件",
"基础组件",
"业务组件"
],
"packages": [
{
"name": "Cell",
Expand Down Expand Up @@ -626,4 +634,4 @@
"author": "yangxiaolu"
}
]
}
}
4 changes: 2 additions & 2 deletions src/locales/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import znCH from './lang/zn-CH';
let defaultMessages = {};

let merged = false;
const vueI18nHandler = function () {
const vueI18nHandler = function() {
const vuei18n = Object.getPrototypeOf(this || Vue).$t;
if (typeof vuei18n === 'function' && !!Vue.locale) {
if (!merged) {
Expand Down Expand Up @@ -57,7 +57,7 @@ function getArgType(arg) {
function simpleTemplate(templ, conf) {
let pars = templ && templ.match(/{.+?}/g);
if (pars && conf) {
pars = pars.map((p) => p.replace(/\{\s*(\w+|\d+).*?\}/, '$1'));
pars = pars.map(p => p.replace(/\{\s*(\w+|\d+).*?\}/, '$1'));
pars.forEach((c, i) => {
let reg = new RegExp('{\\s*' + c + '\\s*(?:=\\s*(\\S*?))?\\s*?}', 'g');
templ = templ.replace(reg, (a, b) => {
Expand Down
10 changes: 5 additions & 5 deletions src/nutui.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ const packages = {
SubSideNavBar: SubSideNavBar,
SideNavBarItem: SideNavBarItem,
Drag: Drag,
Address: Address,
Address: Address
};

const components = {};
const methods = {};
const filters = {};
const directives = {};
pkgList.map((item) => {
pkgList.map(item => {
const pkg = packages[item.name];
if (!pkg) return;

Expand All @@ -213,7 +213,7 @@ pkgList.map((item) => {
}
});

const install = function (Vue, opts = {}) {
const install = function(Vue, opts = {}) {
if (install.installed) return;

if (opts.locale) {
Expand Down Expand Up @@ -251,7 +251,7 @@ const install = function (Vue, opts = {}) {

Vue.use(Lazyload, {
lazyComponent: true,
loading: '//img12.360buyimg.com/imagetools/jfs/t1/73967/28/14561/916/5dc142e4E0666555b/bf33454553c6035e.png',
loading: '//img12.360buyimg.com/imagetools/jfs/t1/73967/28/14561/916/5dc142e4E0666555b/bf33454553c6035e.png'
});
};

Expand All @@ -269,5 +269,5 @@ export default {
...components,
...filters,
...directives,
...methods,
...methods
};
87 changes: 44 additions & 43 deletions src/packages/actionsheet/__test__/actionsheet.spec.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,57 @@
import { shallowMount, mount } from '@vue/test-utils';
import ActionSheet from '../actionsheet.vue';
import { shallowMount, mount } from '@vue/test-utils'
import ActionSheet from '../actionsheet.vue'
import Vue from 'vue';


describe('ActionSheet.vue', () => {
const wrapper = shallowMount(ActionSheet, {
propsData: {
menuItems: [
{
name: '男',
value: 0,
},
{
name: '女',
value: 1,
},
],
},
});
const wrapper = shallowMount(ActionSheet, {
propsData:{
menuItems: [
{
'name': '男',
'value': 0
},
{
'name': '女',
'value': 1
}
]
}
});

it('测试条数', () => {
return Vue.nextTick().then(function () {
expect(wrapper.findAll('.nut-actionsheet-item').length).toBe(2);
it('测试条数', () => {
return Vue.nextTick().then(function () {
expect(wrapper.findAll('.nut-actionsheet-item').length).toBe(2);
})
});
});

it('是否可见', () => {
wrapper.setProps({ isVisible: true });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-actionsheet-mask').isVisible()).toBe(true);
expect(wrapper.find('.nut-actionsheet-panel').isVisible()).toBe(true);
it('是否可见', () => {
wrapper.setProps({isVisible: true });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-actionsheet-mask').isVisible()).toBe(true);
expect(wrapper.find('.nut-actionsheet-panel').isVisible()).toBe(true);
})
});
});

it('显示取消', () => {
wrapper.setProps({ isVisible: true, cancelTxt: '取消' });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-actionsheet-cancel').isVisible()).toBe(true);
expect(wrapper.find('.nut-actionsheet-cancel').text()).toBe('取消');
it('显示取消', () => {
wrapper.setProps({isVisible: true, cancelTxt: '取消' });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-actionsheet-cancel').isVisible()).toBe(true);
expect(wrapper.find('.nut-actionsheet-cancel').text()).toBe('取消');
})
});
});

it('高亮显示', () => {
wrapper.setProps({ chooseTagValue: '男' });
return Vue.nextTick().then(function () {
expect(wrapper.findAll('.nut-actionsheet-item').at(0).contains('.nut-actionsheet-item-active')).toBe(true);
it('高亮显示', () => {
wrapper.setProps({chooseTagValue: '男' });
return Vue.nextTick().then(function () {
expect(wrapper.findAll('.nut-actionsheet-item').at(0).contains('.nut-actionsheet-item-active')).toBe(true);
})
});
});

it('设置列表项展示使用参数', () => {
wrapper.setProps({ optionTag: 'value' });
return Vue.nextTick().then(function () {
expect(wrapper.findAll('.nut-actionsheet-item').at(1).text()).toBe('1');
it('设置列表项展示使用参数', () => {
wrapper.setProps({optionTag: 'value' });
return Vue.nextTick().then(function () {
expect(wrapper.findAll('.nut-actionsheet-item').at(1).text()).toBe('1');
})
});
});
});
});
2 changes: 1 addition & 1 deletion src/packages/actionsheet/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<nut-actionsheet :is-visible="isVisible5" @close="switchActionSheet('isVisible5')">
<div slot="custom" class="custom-wrap"><span>自定义</span></div>
</nut-actionsheet>
<div style="height: 400px;"></div>
<div style="height: 400px"></div>
</div>
</template>

Expand Down
62 changes: 32 additions & 30 deletions src/packages/avatar/__test__/avatar.spec.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
import { shallowMount, mount } from '@vue/test-utils';
import avatar from '../avatar.vue';
import { shallowMount, mount } from '@vue/test-utils'
import avatar from '../avatar.vue'
import Vue from 'vue';


describe('Avatar.vue', () => {
const wrapper = shallowMount(avatar, {});
it('尺寸规格', () => {
wrapper.setProps({ size: 'small' });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-avatar').contains('.avatar-small')).toBe(true);
const wrapper = shallowMount(avatar, {
});
it('尺寸规格', () => {
wrapper.setProps({size: "small" });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-avatar').contains('.avatar-small')).toBe(true);
})
});
});

it('形状类型是否为square', () => {
wrapper.setProps({ shape: 'square' });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-avatar').contains('.avatar-square')).toBe(true);
it('形状类型是否为square', () => {
wrapper.setProps({shape: "square" });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-avatar').contains('.avatar-square')).toBe(true);
})
});
});

it('背景颜色是否为red', () => {
wrapper.setProps({ bgColor: 'red' });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-avatar').hasStyle('background-color', 'red')).toBe(true);
it('背景颜色是否为red', () => {
wrapper.setProps({bgColor: "red" });
return Vue.nextTick().then(function () {
expect(wrapper.find('.nut-avatar').hasStyle('background-color','red')).toBe(true);
})
});
});

it('背景图片是否为设置的bgImage', () => {
wrapper.setProps({ bgImage: 'http://image.png' });
return Vue.nextTick().then(function () {
// console.log(wrapper.find('.nut-avatar').attributes('style'))
expect(wrapper.find('.nut-avatar').hasStyle('background-image', 'url(http://image.png)')).toBe(true);
it('背景图片是否为设置的bgImage', () => {
wrapper.setProps({bgImage: "http://image.png" });
return Vue.nextTick().then(function () {
// console.log(wrapper.find('.nut-avatar').attributes('style'))
expect(wrapper.find('.nut-avatar').hasStyle('background-image','url(http://image.png)')).toBe(true);
})
});
});

it('头像图片是否为设置的bgIcon', () => {
wrapper.setProps({ bgIcon: 'http://image.png' });
return Vue.nextTick().then(function () {
expect(wrapper.find('.icon').hasStyle('background-image', 'url(http://image.png)')).toBe(true);
it('头像图片是否为设置的bgIcon', () => {
wrapper.setProps({bgIcon: "http://image.png" });
return Vue.nextTick().then(function () {
expect(wrapper.find('.icon').hasStyle('background-image','url(http://image.png)')).toBe(true);
})
});
});
});
});
32 changes: 14 additions & 18 deletions src/packages/backtop/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,25 @@
<nut-backtop @click="handleClick"></nut-backtop>
<nut-backtop :bottom="120" :is-animation="false" @click="handleClick">
<div
style="
background-color: rgb(0, 0, 0);
color: rgb(255, 255, 255);
display: flex;
height: 44px;
width: 44px;
align-items: center;
justify-content: center;
"
style="background-color: rgb(0, 0, 0);
color: rgb(255, 255, 255);
display: flex;
height: 44px;
width: 44px;
align-items: center;
justify-content: center;"
>无</div
>
</nut-backtop>
<nut-backtop :bottom="70" @click="handleClick">
<div
style="
background-color: rgb(0, 0, 0);
color: rgb(255, 255, 255);
display: flex;
height: 44px;
width: 44px;
align-items: center;
justify-content: center;
"
style="background-color: rgb(0, 0, 0);
color: rgb(255, 255, 255);
display: flex;
height: 44px;
width: 44px;
align-items: center;
justify-content: center;"
>Top</div
>
</nut-backtop>
Expand Down
Loading

0 comments on commit 420ecdd

Please sign in to comment.