|
| 1 | +import { mount } from "@vue/test-utils"; |
| 2 | +import veTable from "@/ve-table"; |
| 3 | + |
| 4 | +describe("veTable methods", () => { |
| 5 | + const TABLE_DATA = [ |
| 6 | + { |
| 7 | + name: "John", |
| 8 | + date: "1900-05-20", |
| 9 | + hobby: "coding and coding repeat", |
| 10 | + address: "No.1 Century Avenue, Shanghai", |
| 11 | + }, |
| 12 | + { |
| 13 | + name: "Dickerson", |
| 14 | + date: "1910-06-20", |
| 15 | + hobby: "coding and coding repeat", |
| 16 | + address: "No.1 Century Avenue, Beijing", |
| 17 | + }, |
| 18 | + { |
| 19 | + name: "Larsen", |
| 20 | + date: "2000-07-20", |
| 21 | + hobby: "coding and coding repeat", |
| 22 | + address: "No.1 Century Avenue, Chongqing", |
| 23 | + }, |
| 24 | + { |
| 25 | + name: "Geneva", |
| 26 | + date: "2010-08-20", |
| 27 | + hobby: "coding and coding repeat", |
| 28 | + address: "No.1 Century Avenue, Xiamen", |
| 29 | + }, |
| 30 | + { |
| 31 | + name: "Jami", |
| 32 | + date: "2020-09-20", |
| 33 | + hobby: "coding and coding repeat", |
| 34 | + address: "No.1 Century Avenue, Shenzhen", |
| 35 | + }, |
| 36 | + ]; |
| 37 | + |
| 38 | + const COLUMNS = [ |
| 39 | + { |
| 40 | + field: "name", |
| 41 | + key: "a", |
| 42 | + title: "Name", |
| 43 | + align: "center", |
| 44 | + }, |
| 45 | + { |
| 46 | + field: "date", |
| 47 | + key: "b", |
| 48 | + title: "Date", |
| 49 | + align: "left", |
| 50 | + }, |
| 51 | + { |
| 52 | + field: "hobby", |
| 53 | + key: "c", |
| 54 | + title: "Hobby", |
| 55 | + align: "right", |
| 56 | + }, |
| 57 | + { field: "address", key: "d", title: "Address" }, |
| 58 | + ]; |
| 59 | + |
| 60 | + it("scroll method", () => { |
| 61 | + const wrapper = mount(veTable, { |
| 62 | + propsData: { |
| 63 | + columns: COLUMNS, |
| 64 | + tableData: TABLE_DATA, |
| 65 | + maxHeight: 50, |
| 66 | + }, |
| 67 | + }); |
| 68 | + |
| 69 | + expect(0).toEqual(0); |
| 70 | + |
| 71 | + // expect(wrapper.find(".ve-table-container").scrollTop).toBeGreaterThan( |
| 72 | + // 100, |
| 73 | + // ); |
| 74 | + |
| 75 | + // wrapper.vm.scroll({ top: 10 }); |
| 76 | + |
| 77 | + // expect(wrapper.find(".ve-table-container").scrollTop).toEqual(10); |
| 78 | + }); |
| 79 | +}); |
0 commit comments