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)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sv99, Unassigned)

References

Details

Attachments

(1 file)

46 bytes, text/x-github-pull-request
arthurcc
: review+
alive
: review+
julienw
: feedback+
Details | Review
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
Blocks: 1070047
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!
Flags: needinfo?(felash)
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)
Attached file Link to PR
Attachment #8517496 - Flags: review?(felash)
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+
Attachment #8517496 - Flags: review?(alive) → review+
Attachment #8517496 - Flags: review?(arthur.chen) → review+
Keywords: checkin-needed
master: 8fc1eeb2d208e766e48cafd5fb0ff3071d03f57a
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: