Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 2c1d8bc

Browse files
committed
Tests: Add README for bootstrap
1 parent 46d1616 commit 2c1d8bc

File tree

2 files changed

+59
-5
lines changed

2 files changed

+59
-5
lines changed

tests/README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## How to use Bootstrap dependency manager
2+
3+
[Bootstrap](lib/bootstrap.js) is a helper library that will be used to manage dependencies for a test file easily.
4+
5+
Features:
6+
7+
- Used RequireJS to load all the dependencies
8+
- Provides attribute support for various use cases
9+
- Includes all major deps and qunit helpers by default
10+
- RequireJS config is also loaded by Bootstrap
11+
12+
13+
`qunit-assert-classes` and `qunit-assert-domequal` are required by default in bootstrap
14+
15+
`jquery` version can be specified in `jquery param` in url appended by `?jquery=VERSION_NO`
16+
17+
Following attributes are supported by bootstrap and should be mentioned in script tag loading bootstrap:
18+
19+
`data-init` = Specifies if init is required as in testHelper. If `no-backcompat` then bootstrap will include `no-backcompat` otherwise is will include `set-ns` and `widgets/widget.backcompat`
20+
21+
`data-no-backcompat` = Attribute for specifying if backcompat is not needed. Init attribute is require for this to active
22+
23+
`data-full` = This is analogous to requiring index.php file in js folder.
24+
25+
`data-no-autoinit` = Specifies if bootstrap has to call QUnit.start(). If not specified you have to call `QUnit.start()` somewhere in your tests
26+
27+
`data-deps` = All the dependencies are to mentioned here seprated by spaces relative to `js` dir. `widgets` and `events` deps don't need to be appended with `widgets/` and `events/`
28+
29+
`data-modules` = All the test module files are to be mentioned here separated by spaces
30+
31+
`data-init-after-modules` = If you want to include init file after modules are loaded
32+
33+
`data-base-url` = If you want to change the base url of requirejs config. Default url = `../../../js`
34+
35+
### Example HEAD tag of HTML file using bootstrap
36+
37+
```html
38+
<head>
39+
<meta charset="UTF-8" />
40+
<title>jQuery Mobile Navigate Events Test Suite</title>
41+
42+
<script src="../../../../external/requirejs/require.js"></script>
43+
44+
<link rel="stylesheet" href="../../../../external/qunit/qunit.css"/>
45+
<link rel="stylesheet" href="../../../jqm-tests.css"/>
46+
47+
<script src="../../../lib/bootstrap.js"
48+
data-base-url="../../../../js"
49+
data-deps="./early_popstate_handler.js navigate"
50+
data-full="true"
51+
data-modules="event_core">
52+
</script>
53+
</head>
54+
```
55+
56+
- `data-base-url`: specifies base url for requirejs config since we are in folder `integration/navigation/event`
57+
- `data-deps`: All deps which are not in the `js` folder need to be appened with `.js` so that requirejs resolves it locally.
58+
- `data-modules`: Specifies locally resolved main test file
59+

tests/lib/bootstrap.js

-5
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,6 @@
272272
if ( noBackCompat ) {
273273
deps.unshift( "no-backcompat" );
274274
} else {
275-
deps = [
276-
"set-ns",
277-
"widgets/widget.backcompat"
278-
].concat( deps );
279-
280275
deps.unshift( "set-ns", "widgets/widget.backcompat" );
281276
}
282277
} else {

0 commit comments

Comments
 (0)