我正在寫一些茉莉花測試和toContain
未在頁面上找到一個字符串。這裏是其中的一個:爲什麼茉莉花沒有找到我的網頁上的字符串
it('should contain Superhero', function() {
expect(el).toContain('Superhero');
});
這裏是el
的值,它是一個Jquery
對象:
而且,這裏是Karma
錯誤:
Chrome 32.0.1700 (Mac OS X 10.8.5) marvelApp directives detail.window.directive should contain Superhero FAILED
TypeError: Object [object Object] has no method 'indexOf'
at null.<anonymous> (/Users/mhamm/Developer/marvel/test/mainCtrlSpec.js:61:20)
Chrome 32.0.1700 (Mac OS X 10.8.5): Executed 1 of 0 (1 FAILED) ERROR (0 secs/10 mins 37.377 secs)
爲什麼Jasmine
沒有看到我的el
中的超級英雄值?
'[對象的對象]有沒有方法'indexOf'' – andlrc