spec: fix TimeBlockList should add rows correctly

The test was failing with jQuery's $.contains(), which suggested a
compatibility or functionality problem with this method in the
given test context. Converting to native Node.contains() and
unwrapping the jQuery elements to do the comparison fixed the test.

refs FOO-4220

test plan: tests pass

Change-Id: I55b393f46337c1d21733429c838aefc60e0ff66a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/338933
QA-Review: Michael Hulse <michael.hulse@instructure.com>
Product-Review: Michael Hulse <michael.hulse@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Angela Gomba <angela.gomba@instructure.com>
This commit is contained in:
Michael Hulse 2024-01-26 16:42:00 -08:00
parent 27c4d2b5b9
commit 928f576284
1 changed files with 3 additions and 2 deletions

View File

@ -80,8 +80,9 @@ test('should add rows correctly', function () {
const rowsBefore = this.me.rows.length
const data = [Date.parse('next tuesday at 7pm'), Date.parse('next tuesday at 8pm')]
const row = this.me.addRow(data)
equal(this.me.rows.length, rowsBefore + 1)
ok($.contains(this.me.element, row.$row), 'make sure the element got appended to my <tbody>')
strictEqual(this.me.rows.length, rowsBefore + 1, 'row count should increase by 1')
// element and $row are jQuery objects, so we need to compare the DOM elements
ok(this.me.element[0].contains(row.$row[0]), 'make sure the element got appended')
})
test('should validate if all rows are valid and complete or blank', function () {