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

Javascript JsTestDriver Jasmine &茉莉花jquery

Javascript JsTestDriver Jasmine amp; Jasmine-jquery(Javascript JsTestDriver Jasmine amp;茉莉花jquery)
本文介紹了Javascript JsTestDriver Jasmine &茉莉花jquery的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我有很多 Jasmine 單元測試,它們正在運行 Javascript 代碼的單元測試.他們正在使用 Jasmine-jquery 插件來進行 DOM 操作.他們使用 loadFixture 來加載 HTML 的固定裝置

I have lots of Jasmine unit tests, that are running unit tests for Javascripts code. They are using Jasmine-jquery plugin to do DOM manipulation. they use loadFixture, to load fixtures of HTML

我嘗試使用 JsTestDriver 和 JasmineAdapter 自動化這些單元測試但是所有涉及 DOM-jquery 操作的測試都沒有通過?這有什么問題嗎?有沒有辦法將 Jasmine-jquery 與 JsTestDriver 一起使用?

I tried to automate those unit tests, using JsTestDriver, with JasmineAdapter But all tests involve DOM-jquery manipulation are not passing? Is there something wrong with that? Is there a way to use Jasmine-jquery with JsTestDriver?

推薦答案

我會回答自己,因為我找到了解決這個問題的方法.問題是 Jasmine-Jquery 正在使用 ajax 加載 html 夾具,并且它使用相對路徑,假設(shè) html 夾具位于相對于運行 Jasmine 測試的 HTML 容器的某個位置.但是因為 JsTestDriver 將測試加載到它自己的空間"中,所以我們必須更改 Jasmine-Jquery 查找這些 html 夾具的位置,并讓 JsTestDriver 加載它們.

I will answer myself because I found a solution for this problem. The problem was Jasmine-Jquery is using ajax to load the html fixture, and it uses a relative path, assuming the html fixtures are located in somewhere relative to the HTML container that is running Jasmine tests. but because JsTestDriver is loading the tests inside its own "space", so we have to change the location, where Jasmine-Jquery looks for those html fixtures, and make JsTestDriver load them.

所以解決方法如下:

JsTestDriver 具有加載靜態(tài) html 文件的能力.在配置文件中添加以下內(nèi)容:

JsTestDriver has the ability to load static html files. in config file add the following:

服務(wù):-例如:服務(wù):- 固定裝置*.html

Serve: - for example: Serve: - fixtures*.html

現(xiàn)在您可以使用以下格式訪問那些http:localhost:9876/test/fixtures/...你讓 Jasmine-jquery 知道從這個位置加載燈具.

now you can access those with the following format http:localhost:9876/test/fixtures/... you let Jasmine-jquery knows to load the fixtures from this location.

瞧,您的測試將再次運行.

and voila, you will have your tests working again.

這篇關(guān)于Javascript JsTestDriver Jasmine &茉莉花jquery的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

How can I get my jasmine tests fixtures to load before the javascript considers the document to be quot;readyquot;?(在 javascript 認為文檔“準備好之前,如何讓我的 jasmine 測試裝置加載?) - IT屋-程序員軟件開發(fā)技術(shù)
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 - 如何監(jiān)視函數(shù)中的函數(shù)調(diào)用?)
主站蜘蛛池模板: 狠狠av | 中文字幕亚洲一区二区三区 | 国产人久久人人人人爽 | 国产丝袜一区二区三区免费视频 | 久久久新视频 | 精品久久久久久久人人人人传媒 | 国产一区二区三区色淫影院 | 精品国产乱码久久久久久图片 | 成人在线小视频 | 黑人巨大精品欧美一区二区一视频 | 在线播放国产视频 | 日韩美av| 免费看国产一级特黄aaaa大片 | 精品中文字幕在线 | 国产精品久久久久久久久久免费看 | 日本韩国电影免费观看 | 91精品一区二区三区久久久久久 | 亚洲一区二区精品视频在线观看 | 国产精品久久欧美久久一区 | tube国产| 一区在线观看 | 国产成人精品一区二区 | 草草视频在线播放 | 日本人做爰大片免费观看一老师 | 在线不卡视频 | 欧美日韩一区二区在线 | 岛国av免费看 | 亚洲精品久久久久久久久久久 | 婷婷狠狠 | 综合另类| 久在线 | 玖玖爱365| 亚洲 中文 欧美 日韩 在线观看 | 色精品视频 | 免费观看日韩精品 | 99精品久久99久久久久 | 91精品久久久久久久久久入口 | 久久不卡 | 日日噜噜夜夜爽爽狠狠 | 中文av在线播放 | 久久久久久九九九九 |