0
我是新手Jasmine-jQuery。我試圖使用夾具HTML,但測試不通過。與Jasmine-jQuery我試圖改變夾具HTML,但它不起作用
fixture.html:
<html>
<body>
<p id="0">
</p>
</body>
</html>
fake_code_for_question_spec.coffee:
describe "FakeCodeForQuestion", ->
describe "with HTML fixture", ->
beforeEach ->
loadFixtures "fixture.html" ### Load Fixture
@obj = new FakeCodeForQuestion
describe "#addText", ->
beforeEach ->
@obj.addTextToParagraph0() ### Change DOM
it "should add text", ->
expect($('p#0')).toHaveText "text" ### Get Changed DOM
fake_code_for_question.coffee:
root = exports ? this
class root.FakeCodeForQuestion
addTextToParagraph0: ->
$('p0').text "text"
茉莉花結果:
Expected '<p id="0"> </p>' to have text 'text'.
謝謝你的好意。
哦,非常感謝! – weed 2013-03-22 01:13:26