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

Testing in Scaffold not working #26

Closed
zuphilip opened this issue Apr 2, 2016 · 8 comments · Fixed by #27
Closed

Testing in Scaffold not working #26

zuphilip opened this issue Apr 2, 2016 · 8 comments · Fixed by #27

Comments

@zuphilip
Copy link
Collaborator

zuphilip commented Apr 2, 2016

It seems for me that running any tests in scaffold is not working. @adam3smith @aurimasv Can you still run tests in scaffold or can you reproduce the error?

My browser console shows the error:

TypeError: items[i].getElementsByTagName is not a function scaffold.js:928:4
@adam3smith
Copy link
Collaborator

same problem. I can create but not run.

@zuphilip
Copy link
Collaborator Author

zuphilip commented Apr 3, 2016

Okay, I debbuged the problem further. It looks that first the loop variable i equals 0 which is okay and then the variable equals append (function name) and the error happens:

scaffold-error

I guess we have to rewrite the for-loop here... Would you agree that it should be simply be

for (var i=0; i<items.length; i++) {

?

@aurimasv
Copy link
Collaborator

aurimasv commented Apr 3, 2016

Yes, but where is the "append"coming from? Sounds like something is
modifying the array prototype, which is ok, I guess, but that shouldn't be
our code.
On Apr 3, 2016 13:24, "Philipp Zumstein" notifications@github.com wrote:

Okay, I debbuged the problem further. It looks that first the loop
variable i equals 0 which is okay and then the variable equals append
(function name) and the error happens:

[image: scaffold-error]
https://cloud.githubusercontent.com/assets/5199995/14233704/4c1bc4c2-f9d0-11e5-85d1-023955de849a.jpg

I guess we have to rewrite the for-loop here... Would you agree that it
should be simply be

for (var i=0; i<items.length; i++) {

?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#26 (comment)

@zuphilip
Copy link
Collaborator Author

zuphilip commented Apr 3, 2016

I just tested that loop separately: for (j in items) { Zotero.debug(j); } gives

(3)(+0006464): 0
(3)(+0000000): append
(3)(+0000000): remove
(3)(+0000000): item
(3)(+0000000): length

Thus, it seems that these are the functions/methods of (the object) items. No?

@zuphilip
Copy link
Collaborator Author

zuphilip commented Apr 3, 2016

@aurimasv items is a ChromeNodeList and not an array. Does this make sense?

@zuphilip
Copy link
Collaborator Author

zuphilip commented Apr 3, 2016

Hm.. the for loops seem to work now in zuphilip@e8052b1, but there is another error when trying to update a test:

TypeError: listbox.selectedItems.slice is not a function

My impression is that selectedItems changed its type to ChromeNodeList.

Update: Yes, indeed this happend in Firefox 45, see https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/fb998e8c0b94

@zuphilip zuphilip mentioned this issue Apr 3, 2016
@zuphilip
Copy link
Collaborator Author

zuphilip commented Apr 3, 2016

Okay, I think I fixed it.

@dstillman
Copy link
Member

Changed in https://bugzilla.mozilla.org/show_bug.cgi?id=120684, BTW

(Along with [...listbox.selectedItems], Array.from(listbox.selectedItems) also works for this sort of thing.)

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

Successfully merging a pull request may close this issue.

4 participants