mirror of https://github.com/ElemeFE/element
commit
c9d2314750
|
@ -1,5 +1,17 @@
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 1.1.2
|
||||||
|
|
||||||
|
*2016-12-30*
|
||||||
|
|
||||||
|
- Fixed `sortable` and `fixed` attribute of Table not working in Vue 2.1.7+
|
||||||
|
- Fixed Input Number not resetting on blur when input with illegal values, #2098
|
||||||
|
- Removed `title` scoped slot of Collapse, and added `title` named slot, #2100
|
||||||
|
- Fixed range selection in TimePicker not working issue
|
||||||
|
- Fixed Tabs' active tab switching when a non-active tab is removed, #2106
|
||||||
|
- Fixed console error reporting when navigating Select with arrow keys, #2120
|
||||||
|
- Fixed incorrect validation timing of filterable Select in Form, #2120
|
||||||
|
|
||||||
### 1.1.1
|
### 1.1.1
|
||||||
|
|
||||||
*2016-12-29*
|
*2016-12-29*
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
|
### 1.1.2
|
||||||
|
*2016-12-30*
|
||||||
|
|
||||||
|
- 修复 Vue 2.1.7 升级导致的 Table `sortable` 和 `fixed` 无法使用的问题
|
||||||
|
- 修正 Input Number 在手动输入越界值时,blur 触发时没有重置为原来的值的问题,#2098
|
||||||
|
- 移除 Collapse 的 `title` scoped slot, 并新增 `title` named slot,#2100
|
||||||
|
- 修复 TimePicker 范围选择无法使用的问题
|
||||||
|
- 修复 Tabs 删除非当前激活的 tab 后,当前激活的 tab 变化的问题,#2106
|
||||||
|
- 修复 Select 在使用方向键导航时控制台报错的问题,#2120
|
||||||
|
- 修复 Form 中可搜索的 Select 验证时机错误的问题,#2120
|
||||||
|
|
||||||
### 1.1.1
|
### 1.1.1
|
||||||
*2016-12-29*
|
*2016-12-29*
|
||||||
|
|
||||||
|
|
|
@ -132,5 +132,5 @@ Set value via a input box.
|
||||||
## Events
|
## Events
|
||||||
| Event Name | Description | Parameters |
|
| Event Name | Description | Parameters |
|
||||||
|---------- |-------- |---------- |
|
|---------- |-------- |---------- |
|
||||||
| change | triggers when the value changes | value after changing |
|
| change | triggers when the value changes (if the mouse is being dragged, this event only fires when the mouse is released) | value after changing |
|
||||||
|
|
||||||
|
|
|
@ -156,4 +156,4 @@
|
||||||
### Events
|
### Events
|
||||||
| 事件名称 | 说明 | 回调参数 |
|
| 事件名称 | 说明 | 回调参数 |
|
||||||
|---------- |-------- |---------- |
|
|---------- |-------- |---------- |
|
||||||
| change | 值改变时触发 | 改变后的值 |
|
| change | 值改变时触发(使用鼠标拖曳时,只在松开鼠标后触发) | 改变后的值 |
|
||||||
|
|
|
@ -238,7 +238,7 @@
|
||||||
| highlight-current | 是否高亮当前选中节点,默认值是 false。| boolean | — | false |
|
| highlight-current | 是否高亮当前选中节点,默认值是 false。| boolean | — | false |
|
||||||
| current-node-key | 当前选中节点的 key,只写属性 | string, number | — | — |
|
| current-node-key | 当前选中节点的 key,只写属性 | string, number | — | — |
|
||||||
| default-expand-all | 是否默认展开所有节点 | boolean | — | false |
|
| default-expand-all | 是否默认展开所有节点 | boolean | — | false |
|
||||||
| expand-on-click-node | 是否在点击节点的时候展开或者收缩节点,如果为 false,则只有点箭头图标的时候才会展开或者收缩节点。 | boolean | — | false |
|
| expand-on-click-node | 是否在点击节点的时候展开或者收缩节点, 默认值为 true,如果为 false,则只有点箭头图标的时候才会展开或者收缩节点。 | boolean | — | true |
|
||||||
| auto-expand-parent | 展开子节点的时候是否自动展开父节点 | boolean | — | true |
|
| auto-expand-parent | 展开子节点的时候是否自动展开父节点 | boolean | — | true |
|
||||||
| default-expanded-keys | 默认展开的节点的 key 的数组 | array | — | — |
|
| default-expanded-keys | 默认展开的节点的 key 的数组 | array | — | — |
|
||||||
| show-checkbox | 节点是否可被选择 | boolean | — | false |
|
| show-checkbox | 节点是否可被选择 | boolean | — | false |
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"1.0.9": "1.0",
|
"1.0.9": "1.0",
|
||||||
"1.1.1": "1.1"
|
"1.1.2": "1.1"
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "element-ui",
|
"name": "element-ui",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "A Component Library for Vue.js.",
|
"description": "A Component Library for Vue.js.",
|
||||||
"main": "lib/element-ui.common.js",
|
"main": "lib/element-ui.common.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
'error': 'el-icon-circle-cross'
|
'error': 'el-icon-circle-cross'
|
||||||
};
|
};
|
||||||
export default {
|
export default {
|
||||||
name: 'el-alert',
|
name: 'ElAlert',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'el-badge',
|
name: 'ElBadge',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
value: {},
|
value: {},
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'el-card',
|
name: 'ElCard',
|
||||||
|
|
||||||
props: ['header', 'bodyStyle']
|
props: ['header', 'bodyStyle']
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
import Popup from 'element-ui/src/utils/popup';
|
import Popup from 'element-ui/src/utils/popup';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-dialog',
|
name: 'ElDialog',
|
||||||
|
|
||||||
mixins: [Popup],
|
mixins: [Popup],
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
@blur="handleBlur"
|
@blur="handleBlur"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:size="size"
|
:size="size"
|
||||||
|
:max="max"
|
||||||
|
:min="min"
|
||||||
ref="input"
|
ref="input"
|
||||||
>
|
>
|
||||||
<template slot="prepend" v-if="$slots.prepend">
|
<template slot="prepend" v-if="$slots.prepend">
|
||||||
|
@ -49,8 +51,7 @@
|
||||||
bind(el, binding, vnode) {
|
bind(el, binding, vnode) {
|
||||||
let interval = null;
|
let interval = null;
|
||||||
let startTime;
|
let startTime;
|
||||||
|
const handler = () => vnode.context[binding.expression].apply();
|
||||||
const handler = () => vnode.context[binding.expression]();
|
|
||||||
const clear = () => {
|
const clear = () => {
|
||||||
if (new Date() - startTime < 100) {
|
if (new Date() - startTime < 100) {
|
||||||
handler();
|
handler();
|
||||||
|
@ -81,7 +82,7 @@
|
||||||
},
|
},
|
||||||
min: {
|
min: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: -Infinity
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
default: 0
|
default: 0
|
||||||
|
@ -104,6 +105,7 @@
|
||||||
this.$emit('input', this.max);
|
this.$emit('input', this.max);
|
||||||
value = this.max;
|
value = this.max;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentValue: value
|
currentValue: value
|
||||||
};
|
};
|
||||||
|
@ -124,69 +126,57 @@
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
minDisabled() {
|
minDisabled() {
|
||||||
return this.accSub(this.value, this.step) < this.min;
|
return this._decrease(this.value, this.step) < this.min;
|
||||||
},
|
},
|
||||||
maxDisabled() {
|
maxDisabled() {
|
||||||
return this.accAdd(this.value, this.step) > this.max;
|
return this._increase(this.value, this.step) > this.max;
|
||||||
|
},
|
||||||
|
precision() {
|
||||||
|
const { value, step, getPrecision } = this;
|
||||||
|
return Math.max(getPrecision(value), getPrecision(step));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
accSub(arg1, arg2) {
|
toPrecision(num, precision) {
|
||||||
var r1, r2, m, n;
|
if (precision === undefined) precision = this.precision;
|
||||||
try {
|
return parseFloat(parseFloat(Number(num).toFixed(precision)));
|
||||||
r1 = arg1.toString().split('.')[1].length;
|
|
||||||
} catch (e) {
|
|
||||||
r1 = 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
r2 = arg2.toString().split('.')[1].length;
|
|
||||||
} catch (e) {
|
|
||||||
r2 = 0;
|
|
||||||
}
|
|
||||||
m = Math.pow(10, Math.max(r1, r2));
|
|
||||||
n = (r1 >= r2) ? r1 : r2;
|
|
||||||
return parseFloat(((arg1 * m - arg2 * m) / m).toFixed(n));
|
|
||||||
},
|
},
|
||||||
accAdd(arg1, arg2) {
|
getPrecision(value) {
|
||||||
var r1, r2, m, c;
|
const valueString = value.toString();
|
||||||
try {
|
const dotPosition = valueString.indexOf('.');
|
||||||
r1 = arg1.toString().split('.')[1].length;
|
let precision = 0;
|
||||||
} catch (e) {
|
if (dotPosition !== -1) {
|
||||||
r1 = 0;
|
precision = valueString.length - dotPosition - 1;
|
||||||
}
|
}
|
||||||
try {
|
return precision;
|
||||||
r2 = arg2.toString().split('.')[1].length;
|
},
|
||||||
} catch (e) {
|
_increase(val, step) {
|
||||||
r2 = 0;
|
if (typeof val !== 'number') return this.currentValue;
|
||||||
}
|
|
||||||
c = Math.abs(r1 - r2);
|
const precisionFactor = Math.pow(10, this.precision);
|
||||||
m = Math.pow(10, Math.max(r1, r2));
|
|
||||||
if (c > 0) {
|
return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
|
||||||
var cm = Math.pow(10, c);
|
},
|
||||||
if (r1 > r2) {
|
_decrease(val, step) {
|
||||||
arg1 = Number(arg1.toString().replace('.', ''));
|
if (typeof val !== 'number') return this.currentValue;
|
||||||
arg2 = Number(arg2.toString().replace('.', '')) * cm;
|
|
||||||
} else {
|
const precisionFactor = Math.pow(10, this.precision);
|
||||||
arg1 = Number(arg1.toString().replace('.', '')) * cm;
|
|
||||||
arg2 = Number(arg2.toString().replace('.', ''));
|
return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
arg1 = Number(arg1.toString().replace('.', ''));
|
|
||||||
arg2 = Number(arg2.toString().replace('.', ''));
|
|
||||||
}
|
|
||||||
return (arg1 + arg2) / m;
|
|
||||||
},
|
},
|
||||||
increase() {
|
increase() {
|
||||||
if (this.maxDisabled) return;
|
if (this.disabled || this.maxDisabled) return;
|
||||||
const value = this.value || 0;
|
const value = this.value || 0;
|
||||||
if (this.accAdd(value, this.step) > this.max || this.disabled) return;
|
const newVal = this._increase(value, this.step);
|
||||||
this.currentValue = this.accAdd(value, this.step);
|
if (newVal > this.max) return;
|
||||||
|
this.currentValue = newVal;
|
||||||
},
|
},
|
||||||
decrease() {
|
decrease() {
|
||||||
if (this.minDisabled) return;
|
if (this.disabled || this.minDisabled) return;
|
||||||
const value = this.value || 0;
|
const value = this.value || 0;
|
||||||
if (this.accSub(value, this.step) < this.min || this.disabled) return;
|
const newVal = this._decrease(value, this.step);
|
||||||
this.currentValue = this.accSub(value, this.step);
|
if (newVal < this.min) return;
|
||||||
|
this.currentValue = newVal;
|
||||||
},
|
},
|
||||||
handleBlur() {
|
handleBlur() {
|
||||||
this.$refs.input.setCurrentValue(this.currentValue);
|
this.$refs.input.setCurrentValue(this.currentValue);
|
||||||
|
|
|
@ -20,7 +20,7 @@ import Popper from 'element-ui/src/utils/vue-popper';
|
||||||
import { on, off } from 'element-ui/src/utils/dom';
|
import { on, off } from 'element-ui/src/utils/dom';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-popover',
|
name: 'ElPopover',
|
||||||
|
|
||||||
mixins: [Popper],
|
mixins: [Popper],
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
import { hasClass } from 'element-ui/src/utils/dom';
|
import { hasClass } from 'element-ui/src/utils/dom';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-rate',
|
name: 'ElRate',
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
export default {
|
export default {
|
||||||
mixins: [Emitter],
|
mixins: [Emitter],
|
||||||
|
|
||||||
name: 'el-option-group',
|
name: 'ElOptionGroup',
|
||||||
|
|
||||||
componentName: 'ElOptionGroup',
|
componentName: 'ElOptionGroup',
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
export default {
|
export default {
|
||||||
mixins: [Emitter],
|
mixins: [Emitter],
|
||||||
|
|
||||||
name: 'el-option',
|
name: 'ElOption',
|
||||||
|
|
||||||
componentName: 'ElOption',
|
componentName: 'ElOption',
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import Popper from 'element-ui/src/utils/vue-popper';
|
import Popper from 'element-ui/src/utils/vue-popper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-select-dropdown',
|
name: 'ElSelectDropdown',
|
||||||
|
|
||||||
componentName: 'ElSelectDropdown',
|
componentName: 'ElSelectDropdown',
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'el-step',
|
name: 'ElStep',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
title: String,
|
title: String,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'el-steps',
|
name: 'ElSteps',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
space: Number,
|
space: Number,
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'el-switch',
|
name: 'ElSwitch',
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
import ElCheckboxGroup from 'element-ui/packages/checkbox-group';
|
import ElCheckboxGroup from 'element-ui/packages/checkbox-group';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-table-filter-panel',
|
name: 'ElTableFilterPanel',
|
||||||
|
|
||||||
mixins: [Popper, Locale],
|
mixins: [Popper, Locale],
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ const DEFAULT_RENDER_CELL = function(h, { row, column }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-table-column',
|
name: 'ElTableColumn',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
|
|
|
@ -66,7 +66,7 @@ const convertToRows = (originColumns) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-table-header',
|
name: 'ElTableHeader',
|
||||||
|
|
||||||
render(h) {
|
render(h) {
|
||||||
const originColumns = this.store.states.originColumns;
|
const originColumns = this.store.states.originColumns;
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
let tableIdSeed = 1;
|
let tableIdSeed = 1;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-table',
|
name: 'ElTable',
|
||||||
|
|
||||||
mixins: [Locale],
|
mixins: [Locale],
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'el-tab-pane',
|
name: 'ElTabPane',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
label: String,
|
label: String,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'el-tabs',
|
name: 'ElTabs',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "element-theme-default",
|
"name": "element-theme-default",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "Element component default theme.",
|
"description": "Element component default theme.",
|
||||||
"main": "lib/index.css",
|
"main": "lib/index.css",
|
||||||
"style": "lib/index.css",
|
"style": "lib/index.css",
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
import Popper from 'element-ui/src/utils/vue-popper';
|
import Popper from 'element-ui/src/utils/vue-popper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-tooltip',
|
name: 'ElTooltip',
|
||||||
|
|
||||||
mixins: [Popper],
|
mixins: [Popper],
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
import ElCheckbox from 'element-ui/packages/checkbox';
|
import ElCheckbox from 'element-ui/packages/checkbox';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-tree-node',
|
name: 'ElTreeNode',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
node: {
|
node: {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
import {t} from 'element-ui/src/locale';
|
import {t} from 'element-ui/src/locale';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-tree',
|
name: 'ElTree',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -8,7 +8,7 @@ function noop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-upload',
|
name: 'ElUpload',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
ElProgress,
|
ElProgress,
|
||||||
|
|
|
@ -141,7 +141,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
version: '1.1.1',
|
version: '1.1.2',
|
||||||
locale: locale.use,
|
locale: locale.use,
|
||||||
install,
|
install,
|
||||||
Loading,
|
Loading,
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
import { createTest, createVue, destroyVM, triggerEvent } from '../util';
|
import {
|
||||||
|
createTest,
|
||||||
|
createVue,
|
||||||
|
destroyVM,
|
||||||
|
triggerEvent
|
||||||
|
} from '../util';
|
||||||
import DatePicker from 'packages/date-picker';
|
import DatePicker from 'packages/date-picker';
|
||||||
|
|
||||||
const DELAY = 10;
|
const DELAY = 10;
|
||||||
|
@ -27,7 +32,9 @@ describe('DatePicker', () => {
|
||||||
<el-date-picker ref="compo" v-model="value"></el-date-picker>
|
<el-date-picker ref="compo" v-model="value"></el-date-picker>
|
||||||
`,
|
`,
|
||||||
data() {
|
data() {
|
||||||
return { value: '' };
|
return {
|
||||||
|
value: ''
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
const input = vm.$el.querySelector('input');
|
const input = vm.$el.querySelector('input');
|
||||||
|
@ -50,13 +57,13 @@ describe('DatePicker', () => {
|
||||||
arrowLeftElm.click();
|
arrowLeftElm.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 18;
|
count = 20;
|
||||||
while (--count) {
|
while (--count) {
|
||||||
arrowRightElm.click();
|
arrowRightElm.click();
|
||||||
}
|
}
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
expect(spans[0].textContent).to.include(date.getFullYear() - 1);
|
expect(spans[0].textContent).to.include(date.getFullYear() - 1);
|
||||||
expect(spans[1].textContent).to.include(date.getMonth() - 1);
|
expect(spans[1].textContent).to.include(date.getMonth() + 1);
|
||||||
$el.querySelector('td.available').click();
|
$el.querySelector('td.available').click();
|
||||||
vm.$nextTick(_ => {
|
vm.$nextTick(_ => {
|
||||||
expect(vm.value).to.exist;
|
expect(vm.value).to.exist;
|
||||||
|
@ -72,7 +79,9 @@ describe('DatePicker', () => {
|
||||||
<el-date-picker v-model="value" ref="compo"></el-date-picker>
|
<el-date-picker v-model="value" ref="compo"></el-date-picker>
|
||||||
`,
|
`,
|
||||||
data() {
|
data() {
|
||||||
return { value: '' };
|
return {
|
||||||
|
value: ''
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
const input = vm.$el.querySelector('input');
|
const input = vm.$el.querySelector('input');
|
||||||
|
@ -97,7 +106,9 @@ describe('DatePicker', () => {
|
||||||
<el-date-picker v-model="value" ref="compo" :clearable="false"></el-date-picker>
|
<el-date-picker v-model="value" ref="compo" :clearable="false"></el-date-picker>
|
||||||
`,
|
`,
|
||||||
data() {
|
data() {
|
||||||
return { value: '' };
|
return {
|
||||||
|
value: ''
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
const input = vm.$el.querySelector('input');
|
const input = vm.$el.querySelector('input');
|
||||||
|
@ -122,7 +133,9 @@ describe('DatePicker', () => {
|
||||||
<el-date-picker ref="compo" v-model="value"></el-date-picker>
|
<el-date-picker ref="compo" v-model="value"></el-date-picker>
|
||||||
`,
|
`,
|
||||||
data() {
|
data() {
|
||||||
return { value: '' };
|
return {
|
||||||
|
value: ''
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
const input = vm.$el.querySelector('input');
|
const input = vm.$el.querySelector('input');
|
||||||
|
@ -163,7 +176,9 @@ describe('DatePicker', () => {
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return { value: '' };
|
return {
|
||||||
|
value: ''
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
@ -178,8 +193,10 @@ describe('DatePicker', () => {
|
||||||
picker.$el.querySelector('td.available').click();
|
picker.$el.querySelector('td.available').click();
|
||||||
vm.$nextTick(_ => {
|
vm.$nextTick(_ => {
|
||||||
const date = picker.date;
|
const date = picker.date;
|
||||||
|
let month = date.getMonth() + 1;
|
||||||
|
if (month < 10) month = '0' + month;
|
||||||
|
|
||||||
expect(inputValue).to.equal(`${date.getFullYear()}-${date.getMonth() + 1 }`);
|
expect(inputValue).to.equal(`${date.getFullYear()}-${ month }`);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}, DELAY);
|
}, DELAY);
|
||||||
|
@ -442,7 +459,10 @@ describe('DatePicker', () => {
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
panels[1].querySelector('td.available').click();
|
panels[1].querySelector('td.available').click();
|
||||||
|
|
||||||
const { minDate, maxDate } = vm.picker;
|
const {
|
||||||
|
minDate,
|
||||||
|
maxDate
|
||||||
|
} = vm.picker;
|
||||||
expect(minDate).to.exist;
|
expect(minDate).to.exist;
|
||||||
expect(maxDate).to.exist;
|
expect(maxDate).to.exist;
|
||||||
expect(maxDate > minDate).to.true;
|
expect(maxDate > minDate).to.true;
|
||||||
|
@ -534,7 +554,10 @@ describe('DatePicker', () => {
|
||||||
triggerEvent(rightCell, 'click', true);
|
triggerEvent(rightCell, 'click', true);
|
||||||
|
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
const { minDate, maxDate } = vm.picker;
|
const {
|
||||||
|
minDate,
|
||||||
|
maxDate
|
||||||
|
} = vm.picker;
|
||||||
const minMonth = minDate.getMonth();
|
const minMonth = minDate.getMonth();
|
||||||
const maxMonth = maxDate.getMonth();
|
const maxMonth = maxDate.getMonth();
|
||||||
|
|
||||||
|
@ -698,9 +721,10 @@ describe('DatePicker', () => {
|
||||||
const prevMonthLen = vm.picker.$el.querySelectorAll('.prev-month').length;
|
const prevMonthLen = vm.picker.$el.querySelectorAll('.prev-month').length;
|
||||||
const firstWeek = vm.picker.$el.querySelector('tr th');
|
const firstWeek = vm.picker.$el.querySelector('tr th');
|
||||||
const offset = i > 3 ? 7 - i : -i;
|
const offset = i > 3 ? 7 - i : -i;
|
||||||
|
const day = FirstDayOfCurrentMonth === 0 ? 7 : FirstDayOfCurrentMonth;
|
||||||
|
|
||||||
expect(firstWeek.innerText).to.equal(chineseWeek[i - 1]);
|
expect(firstWeek.innerText).to.equal(chineseWeek[i - 1]);
|
||||||
expect(prevMonthLen - FirstDayOfCurrentMonth).to.equal(offset);
|
expect(prevMonthLen - day).to.equal(offset);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -712,15 +736,13 @@ describe('DatePicker', () => {
|
||||||
let test;
|
let test;
|
||||||
vm = createTest(DatePicker, {
|
vm = createTest(DatePicker, {
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
shortcuts: [
|
shortcuts: [{
|
||||||
{
|
text: '今天',
|
||||||
text: '今天',
|
onClick(picker) {
|
||||||
onClick(picker) {
|
test = true;
|
||||||
test = true;
|
picker.$emit('pick', new Date());
|
||||||
picker.$emit('pick', new Date());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
}]
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
const input = vm.$el.querySelector('input');
|
const input = vm.$el.querySelector('input');
|
||||||
|
|
Loading…
Reference in New Issue