mirror of
https://github.com/youzan/vant.git
synced 2025-10-17 16:44:21 +00:00
[new feature] add i18n support (#310)
* fix: Tabbar icon line-height * [new feature] progress add showPivot prop * [new feature] TabItem support vue-router * [new feature] update document header style * [Doc] add toast english ducoment * [new feature] add i18n support * feat: Extract demos from markdown * feat: Base components demos * [new feature] complete demo extract & translate * [fix] text cases * fix: add deepAssign test cases * fix: changelog detail * [new feature] AddressEdit support i18n
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { mount } from 'avoriaz';
|
||||
import AddressEdit from 'packages/address-edit';
|
||||
import AddressDetail from 'packages/address-edit/Detail';
|
||||
import areaList from '../../../docs/mock/area.json';
|
||||
import areaList from '../mock/area.json';
|
||||
|
||||
describe('AddressEdit', () => {
|
||||
let wrapper;
|
||||
|
96
test/unit/specs/deep-assign.spec.js
Normal file
96
test/unit/specs/deep-assign.spec.js
Normal file
@@ -0,0 +1,96 @@
|
||||
import deepAssign from 'packages/utils/deep-assign';
|
||||
|
||||
describe('DatetimePicker', () => {
|
||||
it('basic assign', () => {
|
||||
const a = { foo: 0 };
|
||||
const b = { foo: 0, bar: 1 };
|
||||
const output = { foo: 0, bar: 1 };
|
||||
expect(deepAssign(a, b)).to.eql(output);
|
||||
expect(deepAssign(a, null)).to.eql(a);
|
||||
expect(deepAssign(a, undefined)).to.eql(a);
|
||||
});
|
||||
|
||||
it('same object', () => {
|
||||
const a = { foo: 0 };
|
||||
expect(deepAssign(a, a)).to.eql(a);
|
||||
});
|
||||
|
||||
it('only assign own keys', () => {
|
||||
const Test = function() {};
|
||||
Test.prototype.a = 'many';
|
||||
const test = new Test();
|
||||
test.bar = 1;
|
||||
expect(deepAssign({ foo: 1 }, test, { foo: 1, bar: 1 })).to.eql({
|
||||
foo: 1,
|
||||
bar: 1
|
||||
});
|
||||
});
|
||||
|
||||
it('do not assign undefined values', () => {
|
||||
expect(deepAssign({}, { foo: undefined })).to.eql({});
|
||||
});
|
||||
|
||||
it('do not assign null values', () => {
|
||||
expect(deepAssign({}, { foo: null })).to.eql({});
|
||||
});
|
||||
|
||||
it('assign proprety, if proprety is null in the prototype chain', () => {
|
||||
const Unicorn = function() {};
|
||||
Unicorn.prototype.rainbows = null;
|
||||
const unicorn = new Unicorn();
|
||||
expect(deepAssign(unicorn, { rainbows: 'many' }).rainbows).to.eql('many');
|
||||
});
|
||||
|
||||
it('assign proprety, if proprety is undefined in the prototype chain', () => {
|
||||
const Unicorn = function() {};
|
||||
Unicorn.prototype.rainbows = undefined;
|
||||
const unicorn = new Unicorn();
|
||||
expect(deepAssign(unicorn, { rainbows: 'many' }).rainbows).to.eql('many');
|
||||
});
|
||||
|
||||
it('do not merge with a target proprety in the prototype chain', () => {
|
||||
const amountOfRainbows = { amount: 'many' };
|
||||
const Unicorn = function() {};
|
||||
Unicorn.prototype.rainbows = amountOfRainbows;
|
||||
const unicorn = deepAssign(new Unicorn(), { rainbows: 'none' });
|
||||
expect(unicorn.rainbows).to.eql('none');
|
||||
expect(unicorn.rainbows.amount).to.eql(undefined);
|
||||
expect(Unicorn.prototype.rainbows).to.eql(amountOfRainbows);
|
||||
});
|
||||
|
||||
it('deep assign', () => {
|
||||
const a = {
|
||||
foo: {
|
||||
foo: {
|
||||
foo: true
|
||||
},
|
||||
bar: {
|
||||
bar: false
|
||||
}
|
||||
}
|
||||
};
|
||||
const b = {
|
||||
foo: {
|
||||
foo: {
|
||||
foo: false,
|
||||
bar: true
|
||||
},
|
||||
bar: null
|
||||
},
|
||||
bar: true
|
||||
};
|
||||
const output = {
|
||||
foo: {
|
||||
foo: {
|
||||
foo: false,
|
||||
bar: true
|
||||
},
|
||||
bar: {
|
||||
bar: false
|
||||
}
|
||||
},
|
||||
bar: true
|
||||
};
|
||||
expect(deepAssign(a, b)).to.eql(output);
|
||||
});
|
||||
});
|
@@ -1,5 +1,5 @@
|
||||
import Picker from 'packages/picker';
|
||||
import PickerColumn from 'packages/picker/picker-column';
|
||||
import PickerColumn from 'packages/picker/PickerColumn';
|
||||
import { mount } from 'avoriaz';
|
||||
|
||||
const itemHeight = 44;
|
||||
|
@@ -79,7 +79,7 @@ describe('Popup', () => {
|
||||
setTimeout(() => {
|
||||
expect(wrapper.element.style.display).to.equal('none');
|
||||
done();
|
||||
}, 300);
|
||||
}, 500);
|
||||
}, 300);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user