Jasmine テストを JavaScript から LiveScript に移植しようとしています。Jasmine の機能の 1 つに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(""));
});
});
})();
2 番目の関数が "it" を引数として取っていることがわかります。これに関するライブスクリプトのドキュメントは見つかりませんでしたが、それが機能であることは理解しています (it
関数を別のものに置き換えても問題ありません。これにより、関数を部分的に適用していないことが確信できます)。
ただし、it
関数が必要であり、引数として使用したくありません。では、このスニペットをどのように書くことができますか? ありがとう !