Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests failing in the browser and other test improvements. #6077

Merged
merged 5 commits into from
Jul 8, 2019

Conversation

jansiegel
Copy link
Member

Context

Some tests were only failing in the browser, this change should fix them.

Note: when running tests in the browser, it's important not to do anything and keep the tab focused, as, for example, changing the focus to another window may mess up the focus event recognition, and simply moving the cursor might close the comments pop-up, resulting in a failed test.

Additionally, I modified the ContextMenu plugin and DateEditor to prevent leaving behind containers after destroying the Handsontable instances.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

- Prevent leaving behind unused containers after destroying the Handsontable instances

await sleep(300);

const currentTableWidth = $table.outerWidth();
expect(currentTableWidth).toBeAroundValue($table[0].clientWidth);
expect(currentTableWidth).toBeGreaterThan(initialTableWidth);

done();
Copy link
Member

Choose a reason for hiding this comment

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

done() call is not necessary when async/await is used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Without done the test would timeout before the async part was finished:
image

After updating Jasmine to the latest version this seem to not happen anymore, so I removed it.

@@ -74,6 +74,7 @@ class DateEditor extends TextEditor {
*/
destroyElements() {
this.$datePicker.destroy();
this.datePicker.remove();
Copy link
Member

@budnix budnix Jul 1, 2019

Choose a reason for hiding this comment

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

.remove() method is not supported by IE (https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove). Additionally, can I ask you to add/update test which will test if that element was removed?

@@ -265,6 +265,7 @@ class Menu {
this.close();
this.parentMenu = null;
this.eventManager.destroy();
this.container.remove();
Copy link
Member

Choose a reason for hiding this comment

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

.remove() method is not supported by IE (https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove). Additionally, can I ask you to add/update test which will test if that element was removed?

@budnix budnix assigned jansiegel and unassigned budnix Jul 1, 2019
- Update Jasmine to the latest version
- Get rid of the rest of unneeded DOM elements in the test runner
- Fix some tests for higher density displays
- Temporarily disable tests for tables with caption and, fragmentSelection and one tests for date validation (reasons: #6083, #6085)
@jansiegel
Copy link
Member Author

jansiegel commented Jul 4, 2019

Updates after the CR:

If I'm not mistaken, these changes seem to have fixed (or at least worked around) the Chrome memory leak problem.

@jansiegel jansiegel assigned budnix and unassigned jansiegel Jul 4, 2019
@jansiegel jansiegel requested a review from budnix July 4, 2019 13:25
Copy link
Member

@budnix budnix left a comment

Choose a reason for hiding this comment

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

👍

let isValidFormat = moment(valueToValidate, this.dateFormat || dateEditor.defaultDateFormat, true).isValid();
let isValidDate = moment(new Date(valueToValidate)).isValid() || isValidFormat;
Copy link
Member

Choose a reason for hiding this comment

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

A good catch 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants