我正在尝试将一些 Jasmine 测试从 javascript 移植到 LiveScript。Jasmine 的功能之一是it
. 这是一个例子:
(function(){
describe("The selling page", function() {
// bla bla
it("should display cards.", function() {
expect(selectedCards.count()).toEqual(1);
});
});
所以,我在 LiveScript 中尝试了这个:
do !->
describe "the selling page " !->
it "should display cards" !->
expect (selectedCards.count()).toEqual("")
编译为:
// Generated by LiveScript 1.3.1
(function(){
describe("the selling page ", function(it){ // <--- note the "it"
it("should display cards", function(){
expect(browser.getTitle().toEqual(""));
});
});
})();
您注意到第二个函数将“it”作为参数。我没有找到关于此的 livescript 文档,但我了解它是一个功能(如果我用it
其他东西替换该功能,那一切都很好。这让我确信我没有部分应用一个功能)。
但是,我需要这个it
函数,我不希望它作为一个参数。那我怎么写这个片段呢?谢谢 !