diff --git a/_test/plugins/table.core.js b/_test/plugins/table.core.js
index f0840c9c7f7298da24c22b8d80727db7e55feba2..6dc89189e6e4546dd3e03d20e76abaf7eb1eccad 100644
--- a/_test/plugins/table.core.js
+++ b/_test/plugins/table.core.js
@@ -282,30 +282,71 @@ test("last", function () {
ok(ut.isLastCell(cell), "是最后一个单元格");
ok(!ut.isLastCell(table.rows[1].cells[0]), "不是最后一个单元格");
});
-test("getNextCell",function(){
+test("getNextCell", function () {
var table = getTable("
01 | 2 | 3 | 4 | 6 | 7 |
" +
"11 | 2 | 3 | 4 | 6 | 7 |
" +
"21 | 2 | 3 | 4 | 6 | 7 |
"),
ut = new UT(table);
var cell = table.rows[2].cells[5];
var newCell = ut.getNextCell(cell);
- ok(newCell===table.rows[1].cells[5],"找到正确单元格");
+ ok(newCell === table.rows[1].cells[5], "找到正确单元格");
cell = table.rows[0].cells[4];
newCell = ut.getNextCell(cell);
- ok(!newCell,"顶行不存在nextCell");
- newCell = ut.getNextCell(cell,true);
- ok(newCell===table.rows[1].cells[4],"获取到下一行的单元格");
+ ok(!newCell, "顶行不存在nextCell");
+ newCell = ut.getNextCell(cell, true);
+ ok(newCell === table.rows[1].cells[4], "获取到下一行的单元格");
});
-test("getPreviewCell",function(){
+test("getPreviewCell", function () {
var table = getTable("01 | 2 | 3 | 4 | 6 | 7 |
" +
"11 | 2 | 3 | 4 | 6 | 7 |
" +
"21 | 2 | 3 | 4 | 6 | 7 |
"),
ut = new UT(table);
var cell = table.rows[2].cells[5];
var newCell = ut.getPreviewCell(cell);
- ok(newCell===cell.previousSibling,"找到前置单元格");
+ ok(newCell === cell.previousSibling, "找到前置单元格");
});
+test("getLastCell", function () {
+ var table = getTable("01 | 2 | 3 | 4 | 6 | 7 |
" +
+ "11 | 2 | 3 | 4 | 6 | 7 |
" +
+ "21 | 2 | 3 | 4 | 6 | 7 |
"),
+ ut = new UT(table);
+ var cell = ut.getLastCell();
+ ok(cell === table.rows[2].cells[5], "找到最后一个单元格");
+});
+
+test("getTabNextCell", function () {
+ var table = getTable("01 | 2 | 3 | 4 | 6 | 7 |
" +
+ "11 | 2 | 3 | 4 | 6 | 7 |
" +
+ "21 | 2 | 3 | 4 | 6 | 7 |
"),
+ ut = new UT(table);
+ var rows = table.rows,
+ cell = rows[0].cells[0];
+ var newCell = ut.getTabNextCell(cell);
+ ok(newCell === table.rows[0].cells[1], "找到最后一个单元格");
+ newCell = ut.getTabNextCell(rows[0].cells[5]);
+ ok(newCell === table.rows[1].cells[0], "找到下一行的第一个单元格");
+});
+
+test("getSameStartPosXCells", function () {
+ var table = getTable("01 | 2 | 3 | 4 | 6 | 7 |
" +
+ "11 | 2 | 3 | 4 | 6 | 7 |
" +
+ "21 | 2 | 3 | 4 | 6 | 7 |
"),
+ ut = new UT(table);
+ var cell = table.rows[0].cells[1];
+ var cells = ut.getSameStartPosXCells(cell);
+ equal(cells.length, 3, "获取到三个单元格")
+
+ table = getTable("01 | 2 | 3 | 4 | 6 | 7 |
" +
+ "11 | 2 | 3 | 4 | 6 | 7 |
" +
+ "21 | 2 | 4 | 6 | 7 |
");
+ ut = new UT(table);
+ cells = ut.getSameStartPosXCells(cell);
+ ok(cells.length === 2, "获取到2个单元格");
+
+ cells = ut.getSameStartPosXCells(table.rows[0].cells[0]);
+ ok(cells.length===3,"获取到三个单元格")
+});