0

I have a cshtml view which can be accessed as:

http:/<address>/MyController/MyView

Some Javascript functions use

document.getElementById("#id") 

to fetch the appropriate element and take some actions on that.

DOM while running Jasmine test is Jasmine tests page DOM. So the function will return null everytime. Is it possible to use the same function or I have to make some changes if I want to write Jasmine tests?

aaa
  • 1,114
  • 12
  • 19
  • Not sure if it's your problem, but `#id` is a CSS selector. `getElementById` doesn't take a CSS selector as argument, but an id (you shouldn't have the `#` prefix). – HoLyVieR Sep 18 '13 at 15:03
  • possible duplicate of [how to unit test DOM manipulation (with jasmine)](http://stackoverflow.com/questions/16163852/how-to-unit-test-dom-manipulation-with-jasmine) – Paul Sweatte Apr 23 '14 at 23:04

0 Answers0