Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

fix empty dropdown regression #85

Merged
merged 4 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,7 @@
Issue: https://github.com/plotly/dash-table/issues/68
Issue: https://github.com/plotly/dash-table/issues/73
Issue: https://github.com/plotly/dash-table/issues/76

## RC14 - Empty dropdown setting value regression fix

Issue: https://github.com/plotly/dash-table/issues/83
6 changes: 3 additions & 3 deletions dash_table/bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dash_table/demo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_table/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-table",
"version": "3.0.0rc12",
"version": "3.0.0rc14",
"description": "Dash table",
"main": "build/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-table",
"version": "3.0.0rc12",
"version": "3.0.0rc14",
"description": "Dash table",
"main": "build/index.js",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion src/core/comparer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
function isPlainObject(candidate: any) {
return typeof candidate === 'object' && candidate.constructor === Object;
return candidate !== undefined &&
candidate !== null &&
typeof candidate === 'object' &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeof null is 'object', this caused an error to be thrown, adding check for undefined just so it's all very explicit

candidate.constructor === Object;
}

export function isEqual(obj1: object, obj2: object, deep: boolean = false) {
Expand Down
25 changes: 25 additions & 0 deletions tests/e2e/cypress/integration/edit_cell_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,31 @@ describe('edit cell', () => {
cy.visit('http://localhost:8080');
});

it('can delete dropdown', () => {
DashTable.getCell(0, 8).trigger('mouseover');
DashTable.getCell(0, 8).within(() => cy.get('.Select-clear').click());
DashTable.getCell(0, 8).within(() => cy.get('.Select-placeholder').should('exist'));
});

it('can delete dropdown and set value', () => {
DashTable.getCell(0, 8).trigger('mouseover');
DashTable.getCell(0, 8).within(() => cy.get('.Select-clear').click());
DashTable.getCell(0, 8).within(() => cy.get('.Select-placeholder').should('exist'));

DashTable.getCell(0, 8).within(() => cy.get('div.Select').click()).then(() => {
DashTable.getCell(0, 8).within(() => {
cy.get('.Select-option').then($options => {
const target = $options[0];
if (target) {
cy.wrap(target).click({ force: true });
}
});
});
});

DashTable.getCell(0, 8).within(() => cy.get('.Select-placeholder').should('not.exist'));
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test for delete + test for delete + set value after


it('can edit dropdown', () => {
let initialValue: string;
let expectedValue: string;
Expand Down