Closed
Bug 1093669
Opened 11 years ago
Closed 11 years ago
[system] shrink_ui_test assert.deepEqual Nodes fail in newer version chai
Categories
(Firefox OS Graveyard :: Gaia::System, defect)
Firefox OS Graveyard
Gaia::System
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: sv99, Unassigned)
References
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20141104030202
Steps to reproduce:
163: assert.deepEqual(tempTip.parentNode, fakeParent); fail in newer version chai
really tempTip.parentNode and fakeParent not Equal!!
used version chai have problems in assert.deepEqual - newer version assert.deepEqual checked objects with his prototypes
I try replace assert.deepEqual with
function checkNodes (test, expected) {
for (var key in expected) {
if ((key !== 'children') && (key !== 'lastElementChild')
&& (key !== 'firstElementChild') && (key !== 'childNodes') ) {
assert.deepEqual(test[key], expected[key], 'key: ' + key);
}
}
}
stopped on forth not equal property!
Comment 2•11 years ago
|
||
I think in this specific case we need to use assert.equal, it makes no sense to check DOM nodes using deepEqual. But clearly the test is wrong.
I added ids to all elements we used in the test so that the error message makes sense. The main reason the test is wrong is that:
* in shrinkingUI.prototype._setTip: we append to backgroundElement. But backgroundElement is set once, in the constructor. And we never change this then.
So I fixed the test replacing the deepEqual line with:
assert.equal(tempTip.parentNode, fakeApp.element.parentNode);
But also removing all the fakeParent initialization (2 first lines in the test).
Flags: needinfo?(felash)
Attachment #8517496 -
Flags: review?(felash)
Comment 4•11 years ago
|
||
Comment on attachment 8517496 [details] [review]
Link to PR
lgtm, let's ask to Arthur who wrote this at first, and alive as peer.
Attachment #8517496 -
Flags: review?(felash)
Attachment #8517496 -
Flags: review?(arthur.chen)
Attachment #8517496 -
Flags: review?(alive)
Attachment #8517496 -
Flags: feedback+
Updated•11 years ago
|
Attachment #8517496 -
Flags: review?(alive) → review+
Updated•11 years ago
|
Attachment #8517496 -
Flags: review?(arthur.chen) → review+
Keywords: checkin-needed
Comment 5•11 years ago
|
||
master: 8fc1eeb2d208e766e48cafd5fb0ff3071d03f57a
You need to log in
before you can comment on or make changes to this bug.
Description
•