久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Jasmine 2.0:重構 1.3 的 runs() 和 waitsFor()

Jasmine 2.0: refactoring out 1.3#39;s runs() and waitsFor()(Jasmine 2.0:重構 1.3 的 runs() 和 waitsFor())
本文介紹了Jasmine 2.0:重構 1.3 的 runs() 和 waitsFor()的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

最近發布的 Jasmine 2.0 刪除了 等待函數以及來自 Async Jasmine 1.3 的 runs().

The recently released Jasmine 2.0 removes the waits functions and the runs() from the Async Jasmine 1.3.

我有舊的 1.3 測試想要轉換到新樣式.

I have old 1.3 tests I'd like to transition to the new style.

對于等待,在大多數情況下,您似乎可以仔細編寫 beforeEach()afterEach() 以獲得相同的效果.

For the waits, in most cases it seems like you can write beforeEach() and afterEach() carefully for the same effect.

重現 runs() 的最佳方法是簡單地按順序執行包含的函數?

What is the best way to reproduce the runs() which simply executes the contained functions sequentially?

我的第一次嘗試:

runs(function() {
  expect(true).toBe(true);
}

變成

(function() {
  expect(true).toBe(true);
})()

推薦答案

可以在 it() 塊中使用 setTimeout.

It is possible to use a setTimeout in your it() block.

it("is asynchronous", function(done) {
  var isItDone = false;
  $.ajax('/some/url').success(function() { isItDone = true; });

  setTimeout(function(){
    expect(isItDone).toBeTrue();
    done(); // call this to finish off the it block
  }, 500);

});

但是,我發現這大大降低了我的測試套件的速度,因此我創建了自己的擴展程序,該擴展程序重新創建了 waitsFor 提供的輪詢功能.

However, I found that that slowed down my test suite dramatically so I created my own extension which recreates the polling functionality that waitsFor provided.

https://gist.github.com/abreckner/110e28897d42126a3bb9

這篇關于Jasmine 2.0:重構 1.3 的 runs() 和 waitsFor()的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I get my jasmine tests fixtures to load before the javascript considers the document to be quot;readyquot;?(在 javascript 認為文檔“準備好之前,如何讓我的 jasmine 測試裝置加載?) - IT屋-程序員軟件開發技術
What do jasmine runs and waitsFor actually do?(jasmine 運行和等待實際上是做什么的?)
How to provide mock files to change event of lt;input type=#39;file#39;gt; for unit testing(如何提供模擬文件來更改 lt;input type=filegt; 的事件用于單元測試)
How to unit test a chained method using Jasmine(如何使用 Jasmine 對鏈式方法進行單元測試)
How do I inject $rootScope into an AngularJS unit test?(如何將 $rootScope 注入 AngularJS 單元測試?)
Jasmine - How to spy on a function call within a function?(Jasmine - 如何監視函數中的函數調用?)
主站蜘蛛池模板: 精品视频在线观看 | 中文字幕人成乱码在线观看 | 不卡在线视频 | 欧美一区二区三区在线观看 | 亚洲三区在线观看 | 毛片免费在线观看 | 日日操夜夜操天天操 | 久热爱 | 国产精品久久久久久亚洲调教 | 久久久国产视频 | 午夜视频在线免费观看 | 国产高清精品在线 | 日韩精品av一区二区三区 | 亚洲一区综合 | 国产91观看 | 久久69精品久久久久久久电影好 | 欧美亚洲国产一区二区三区 | 成人性视频在线播放 | 日日摸日日碰夜夜爽2015电影 | 97精品久久| 日韩欧美高清 | 精品综合 | 日韩精品一区二区三区在线播放 | 自拍偷拍亚洲一区 | 一区二区三区国产精品 | av一区二区在线观看 | 欧美日韩一区二区三区四区 | 精品福利在线 | 精品免费视频一区二区 | av片在线观看 | 自拍偷拍亚洲一区 | 天天天插 | 久久com | 一级片在线免费看 | 日韩精品一区二区三区视频播放 | 国产精品大全 | 无吗视频| 国产精品久久久久久av公交车 | 新91 | av日韩在线播放 | 天堂一区二区三区 |