This repository was archived by the owner on Jun 4, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathdash_test.ts
62 lines (50 loc) · 2.04 KB
/
dash_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import DashTable from 'cypress/DashTable';
import DOM from 'cypress/DOM';
import Key from 'cypress/Key';
describe('dash basic', () => {
beforeEach(() => {
cy.visit('http://localhost:8081');
});
it('can get cell', () => {
DashTable.getCell(0, 0).click();
DashTable.getCell(0, 0).within(() => cy.get('input').should('have.value', '0'));
cy.get('button.next-page').click();
DashTable.getCell(0, 0).within(() => cy.get('input').should('have.value', '250'));
});
it('cell click selects all text', () => {
DashTable.getCell(0, 1).click();
DashTable.getCell(0, 1).within(() =>
cy.get('input').then($inputs => {
const $input = $inputs[0];
expect($input.selectionStart).to.equal(0);
expect($input.selectionEnd).to.equal($input.value.length);
})
);
});
// https://github.com/plotly/dash-table/issues/50
it('can edit last and update dataframe on "enter"', () => {
DashTable.getCell(249, 0).click();
DOM.focused.then($input => {
const initialValue = $input.val();
DOM.focused.type(`abc${Key.Enter}`);
cy.get('#container').should($container => {
expect($container.first()[0].innerText).to.equal(`[249][0] = ${initialValue} -> abc`);
});
});
});
it('can edit last and update dataframe when clicking outside of cell', () => {
DashTable.getCell(249, 0).click();
DOM.focused.then($input => {
const initialValue = $input.val();
DOM.focused.type(`abc`);
DashTable.getCell(248, 0).click();
cy.get('#container').should($container => {
expect($container.first()[0].innerText).to.equal(`[249][0] = ${initialValue} -> abc`);
});
});
});
it('can get cell with double click', () => {
DashTable.getCell(3, 1).within(() => cy.get('div').dblclick());
DashTable.getCell(3, 1).should('have.class', 'focused');
});
});