以下mocha嵌套测试套件结构按预期运行:
mocha --timeout 25000 test.js
describe('test suite 1', function() {
it('unit test 1', (done) => {
describe('test suite 2', function() {
it('unit test 2') {
describe('test suite 3', function() {
it('unit test 3') {
Run Code Online (Sandbox Code Playgroud)
我不明白为什么在运行测试时不是这种情况:
mocha --recursive --timeout 25000
查看调试日志我可以清楚地看到it 2并且it 3没有运行.我必须使用,mocha --recursive --timeout 25000因为我有更多的测试套件文件.
目前,我必须分别检查每个可能存在的参数.
if (req.query.param1 != undefined ) {
}
if (req.query.param2 != undefined ) {
}
if (req.query.param3 != undefined ) {
}
...
Run Code Online (Sandbox Code Playgroud) 我想要这个:使用 jquery mobile 和 phonegap 将 html 文件加载到 data-role=page 中:我的项目有很多带有独立页面的小型 HTML 文件。
我用:
索引.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
Inicio :: Autenticacion
</title>
<meta name="viewport" content="width=device-width,height=device-height, initial-scale=1">
<link rel="stylesheet" href="jsmobile/jquery.mobile-1.2.0.min.css" type="text/css">
<script src="jsmobile/jquery.js" type="text/javascript"></script>
<script src="jsmobile/jquery.mobile-1.2.0.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$('#boton').bind('click', function(event) {
$.mobile.loadPage("Fichero/index.html",{pageContainer:$("#container1")});
});
});
</script>
</head>
<body>
<div data-role="page" id="container0">
<div data-role="content">
<a id="boton" >Change Page</a>
</div>
</div>
<div id="container1">
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
文件:Fichero/index.html
<div date-role="page" id="micro">
<div data-role="header" >
<h1>Test Heas</h1>
</div><!-- /header …Run Code Online (Sandbox Code Playgroud) 我试图使用以下XML将ImageView放在布局的底部:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#EEEEEE"
android:gravity="center"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:src="@drawable/photo" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我按照此处的说明http://sandipchitale.blogspot.co.uk/2010/05/linearlayout-gravity-and-layoutgravity.html
唯一的区别是我在这里使用ImageView而不是Button:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/Button03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="bottom" >
</Button>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这把按钮放在预期的位置:

不幸的是,在帖子顶部的我的XML中并非如此.ImageView没有放在底部,因为参考XML中的Button是.

任何想法为什么会发生?