Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

angular.js TypeError: Cannot call method "charAt" of undefined #17

Open
joescii opened this issue Jan 9, 2014 · 2 comments
Open

angular.js TypeError: Cannot call method "charAt" of undefined #17

joescii opened this issue Jan 9, 2014 · 2 comments

Comments

@joescii
Copy link
Contributor

joescii commented Jan 9, 2014

I'm attempting to utilize this plugin to execute tests against some angular-based code. Including angular.js script via EnvJasmine.loadGlobal is sufficient to reproduce this issue. I have verified this issue occurs in angular 1.2.1-1.2.7. It does NOT happen if using angular 1.2.0

The plugin errors with this message:
TypeError: Cannot call method "charAt" of undefined

I believe the error occurs on this line where the urlParsingNode.pathname object is undefined.

The urlParsingNode is instantiated on this line in angular. Angular creates the document anchor, and later sets the href attribute. While this must certainly work well in browsers, the returned object has pathname undefined. The idea is that an anchor tag should correctly handle URL parsing for angular, but in the Rhino environment... no dice.

My project does NOT utilize require.js. I've confirmed this occurs on both Windows and Linux platforms.

@joescii
Copy link
Contributor Author

joescii commented Jan 9, 2014

Also, I tried pointing window.location to a local html file in hopes that would allow document to behave as in a browser environment, but that didn't help.

@joescii
Copy link
Contributor Author

joescii commented Jan 9, 2014

Asked this question on Stackoverflow.

joescii added a commit to joescii/sbt-jasmine-plugin that referenced this issue Jan 10, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant