HTML (DOM) testing with Jasmine or other framework

Asked

Viewed 170 times

0

How do I test HTML with Jasmine? I know there’s a guy named jquery-Jasmine.js who does this but I have no idea how to install it because npm doesn’t work when I try to install it (it says that Git might be in trouble, but all the other plugins work differently when trying to install). So, if you use Jasmine, could you tell me how to test HTML with it? Or if you use another testing framework that works with DOM as well, could you tell me?

Thank you!

EDIT: I use Angularjs and, having an element with the attribute ng-model="nome" and a label <label id='replicaNome'>{{nome}}</label>, i would like to do the following test: Every value that is written in ng-model="name" should be replicated in the label, something like that:

it('Teste de mudança de HTML no projeto', function () {
    document.getElementById("nome").innerHTML("Testando");
    expect(document.getElementById("teste").innerHTML).toBe("Testando");
});

Thank you!

  • Junior, put here what you want to test that we help you with what we know. I use Jasmine in the tests we do for the Mootools. Here is an example: http://jsfiddle.net/Bw2tA/

  • Sergio edited the question, thank you!

  • Can you also give an example of the code you want to test? ie, a line of code that produces a result that the test should check.

  • 1

    I managed to do with Protractor, thank you Sérgio!

  • Put here as a response the conclusion you reached, which may be useful to others as well.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.