下面的代碼片段來自angular's documentation。這裏做的it()
函數是什麼(我假設它有一些常規含義,否則沒有上下文似乎給出它的含義)?我沒有在angular的網站上看到它的任何提及。由於它的名字,它也很難谷歌。上下文是關於代碼測試。這裏做的it()函數是什麼?
it('should say hello', function() {
var scopeMock = {};
var cntl = new MyController(scopeMock);
// Assert that username is pre-filled
expect(scopeMock.username).toEqual('World');
// Assert that we read new username and greet
scopeMock.username = 'angular';
scopeMock.sayHello();
expect(scopeMock.greeting).toEqual('Hello angular!');
});
這是用於在[茉莉測試框架]定義測試(http://jasmine.github.io/2.2/introduction的功能之一。 HTML)和其他類似的。 – 2015-02-05 20:18:37
'it','expect'和'.toEqual'這裏來自一些測試套件,而不是Angular。 – Bergi 2015-02-05 20:18:54