Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
691a49fc
Commit
691a49fc
authored
Oct 28, 2016
by
qingwei.li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Table: add sortable test
parent
ad30305d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
13 deletions
+47
-13
examples/docs/zh-cn/table.md
examples/docs/zh-cn/table.md
+1
-1
packages/table/src/table-column.js
packages/table/src/table-column.js
+0
-9
test/unit/index.js
test/unit/index.js
+1
-1
test/unit/specs/table.spec.js
test/unit/specs/table.spec.js
+45
-2
No files found.
examples/docs/zh-cn/table.md
View file @
691a49fc
...
...
@@ -945,4 +945,4 @@
| filters | 数据过滤的选项,数组格式,数组中的元素需要有 text 和 value 属性。 | Array
[
{ text, value }
]
| — | — |
| filter-multiple | 数据过滤的选项是否多选 | Boolean | — | true |
| filter-method | 数据过滤使用的方法,如果是多选的筛选项,对每一条数据会执行多次,任意一次返回 true 就会显示。 | Function(value, row) | — | — |
| filteredValue | 选中的数据过滤项,如果需要自定义表头过滤的渲染方式,可能会需要此属性。 | Array | — | — |
\ No newline at end of file
| filtered-value | 选中的数据过滤项,如果需要自定义表头过滤的渲染方式,可能会需要此属性。 | Array | — | — |
\ No newline at end of file
packages/table/src/table-column.js
View file @
691a49fc
...
...
@@ -49,15 +49,6 @@ const forced = {
},
sortable
:
false
}
// filter: {
// headerTemplate: function(h) {
// return '#';
// },
// template: function(h, { row, column }) {
// return <el-tag type="primary" style="height: 16px; line-height: 16px; min-width: 40px; text-align: center">{ row[column.property] }</el-tag>;
// },
// resizable: false
// }
};
const
getDefaultColumn
=
function
(
type
,
options
)
{
...
...
test/unit/index.js
View file @
691a49fc
...
...
@@ -4,7 +4,7 @@ Function.prototype.bind = require('function-bind');
require
(
'
packages/theme-default/src/index.css
'
);
// require all test files (files that ends with .spec.js)
const
testsContext
=
require
.
context
(
'
./specs
'
,
true
,
/
\.
spec$/
);
const
testsContext
=
require
.
context
(
'
./specs
'
,
true
,
/
table
\.
spec$/
);
testsContext
.
keys
().
forEach
(
testsContext
);
// require all src files except main.js for coverage.
...
...
test/unit/specs/table.spec.js
View file @
691a49fc
...
...
@@ -420,7 +420,6 @@ describe('Table', () => {
},
DELAY
);
});
// TODO
it
(
'
resizable
'
,
done
=>
{
const
vm
=
createTable
(
'
resizable
'
,
...
...
@@ -712,15 +711,59 @@ describe('Table', () => {
});
describe
(
'
sortable
'
,
()
=>
{
const
vm
=
createTable
(
''
,
''
,
''
,
'
sortable
'
);
it
(
'
render
'
,
done
=>
{
const
vm
=
createTable
(
''
,
''
,
''
,
'
sortable
'
);
setTimeout
(
_
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.caret-wrapper
'
)).
to
.
length
(
1
);
destroyVM
(
vm
);
done
();
},
DELAY
);
});
it
(
'
sortable method
'
,
done
=>
{
const
vm
=
createTable
(
'
sortable :sort-method="sortMethod"
'
,
''
,
''
,
''
,
{
methods
:
{
sortMethod
(
a
,
b
)
{
return
a
.
runtime
<
b
.
runtime
;
}
}
});
setTimeout
(
_
=>
{
const
elm
=
vm
.
$el
.
querySelector
(
'
.caret-wrapper
'
);
elm
.
click
();
setTimeout
(
_
=>
{
const
lastCells
=
vm
.
$el
.
querySelectorAll
(
'
.el-table__body-wrapper tbody tr td:last-child
'
);
expect
(
toArray
(
lastCells
).
map
(
node
=>
node
.
textContent
)).
to
.
eql
([
'
100
'
,
'
95
'
,
'
92
'
,
'
92
'
,
'
80
'
]);
destroyVM
(
vm
);
done
();
},
DELAY
);
},
DELAY
);
});
it
(
'
sort-change
'
,
done
=>
{
let
result
;
const
vm
=
createTable
(
'
sortable="custom"
'
,
''
,
''
,
''
,
{
methods
:
{
sortChange
(...
args
)
{
result
=
args
;
}
}
},
'
@sort-change="sortChange"
'
);
setTimeout
(
_
=>
{
const
elm
=
vm
.
$el
.
querySelector
(
'
.caret-wrapper
'
);
elm
.
click
();
setTimeout
(
_
=>
{
expect
(
result
).
to
.
exist
;
destroyVM
(
vm
);
done
();
},
DELAY
);
},
DELAY
);
});
});
describe
(
'
click sortable column
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment