Skip to content

Commit fa04416

Browse files
committed
Update ve-table-cell-edit.spec.js
1 parent 56f0b98 commit fa04416

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

tests/unit/specs/ve-table-cell-edit.spec.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { cloneDeep } from "lodash";
33
import veTable from "@/ve-table";
44
import { later } from "../util";
55
import { KEY_CODES } from "../constant";
6-
import cellEditor from "@/ve-table/src/editor/edit-input.jsx";
6+
// import cellEditor from "@/ve-table/src/editor/edit-input.jsx";
7+
import { HOOKS_NAME } from "@/ve-table/src/util/constant";
78

89
describe("veTable cell edit", () => {
910
const TABLE_DATA = [
@@ -1952,4 +1953,40 @@ describe("veTable cell edit", () => {
19521953
wrapper.find(".ve-table-edit-input-container-show").exists(),
19531954
).toBe(true);
19541955
});
1956+
1957+
it("cell editing with table scrolling", async () => {
1958+
// this.hooks.triggerHook(HOOKS_NAME.TABLE_CONTAINER_SCROLL);
1959+
1960+
const wrapper = mount(veTable, {
1961+
propsData: {
1962+
columns: COLUMNS,
1963+
tableData: cloneDeep(TABLE_DATA),
1964+
editOption: {
1965+
// cell value change
1966+
cellValueChange: ({ row, column }) => {},
1967+
},
1968+
rowKeyFieldName: "rowKey",
1969+
},
1970+
});
1971+
1972+
// td
1973+
const firstCell = wrapper
1974+
.findAll(".ve-table-body-tr")
1975+
.at(1)
1976+
.findAll(".ve-table-body-td")
1977+
.at(1);
1978+
1979+
firstCell.trigger("click");
1980+
firstCell.trigger("dblclick");
1981+
1982+
await later();
1983+
1984+
const cellEditor = wrapper.findComponent({ name: "VeTableEditIput" });
1985+
1986+
cellEditor.vm.hooks.triggerHook(HOOKS_NAME.TABLE_CONTAINER_SCROLL);
1987+
1988+
expect(
1989+
wrapper.find(".ve-table-edit-input-container-show").exists(),
1990+
).toBe(true);
1991+
});
19551992
});

0 commit comments

Comments
 (0)