-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
- 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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/editors/dateEditor.js
Outdated
@@ -74,6 +74,7 @@ class DateEditor extends TextEditor { | |||
*/ | |||
destroyElements() { | |||
this.$datePicker.destroy(); | |||
this.datePicker.remove(); |
There was a problem hiding this comment.
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?
src/plugins/contextMenu/menu.js
Outdated
@@ -265,6 +265,7 @@ class Menu { | |||
this.close(); | |||
this.parentMenu = null; | |||
this.eventManager.destroy(); | |||
this.container.remove(); |
There was a problem hiding this comment.
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?
- 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)
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. |
There was a problem hiding this 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good catch 👍
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 andDateEditor
to prevent leaving behind containers after destroying the Handsontable instances.Types of changes