An implementation of the excellent Bootstrap framework using the Dojo Toolkit. This project replaces the Bootstrap JavaScript components with AMD-compatible Dojo modules. Tested with Dojo 1.9.3 and Bootstrap 3.1.1.
git clone git://github.com/xsokev/Dojo-Bootstrap.git
- Add dojo sdk (or a symbolic link to the dojo sdk) under the vendor folder as follows:
└── vendor
└── dojo
├── dojo
└── util
- Point your browser to
http://host/path/to/Dojo-bootstrap/tests/index.html
See examples in test/test_*.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dojo-Bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="path/to/bootstrap/styles.css">
</head>
<body>
<button type="button" id="loading-button" class="btn btn-primary" data-loading-text="Loading...">Load</button>
<script>
var dojoConfig = {
async: 1,
packages: [
{ name: "bootstrap", location: "path/to/Dojo-Bootstrap" }
]
};
</script>
<script type="text/javascript" src="path/to/dojo/dojo/dojo.js"></script>
<script>
require(["bootstrap/Button", "dojo/query"], function (Button, query) {
query("#loading-button").on("click", function(e){
query(e.target).button('loading');
setTimeout(function(){
query(e.target).button('reset');
}, 2000);
});
});
</script>
</body>
</html>
Currently this project is in the process of transitioning from using DOH to using the Intern to run the test suites. As test suites are converted to use the Intern, the DOH suites will be phased out.
To run the intern tests, you will need to first install the Intern by running the following at the command line:
npm install
NOTE: The Intern looks for Dojo to be installed under the vendor
(see above).
To run the Intern unit test suites in a browser:
- open your browser and the browser's console window
- load
http://host/path/to/Dojo-bootstrap/node_modules/intern/client.html?config=tests/intern
You should see something like:
Using the Intern's test runnner against a local Selenium install offers many advantages including:
- running your tests in multiple browsers from the command line
- code coverage reporting
- running functional test suites
- automate running your tests with Grunt
You will need to first download Selenium Server and chromedriver. See this issue for several suggestions on how to accomplish this:
Once you've downloaded selenium, the Grunt selenium-launch
task is confgiured to look for the .jar file under vendor/selenium
, so either create that folder and copy the file there or create a symbolic link from vendor/selenium
to the folder in which your selenium .jar file was downloaded. The vendor folder should now look like this:
└── vendor
└── dojo
├── dojo
└── util
└── selenium
└──selenium-server-standalone-2.42.2.jar
You will also need to make sure the path to the chromedriver is in your system's PATH variable.
Finally, you should double check the intern and Grunt configuration files to make sure that they match your environment. Make sure they reference the same version of Selenium that you installed and add/remove any browsers to match the ones that you have installed.
intern.js
capabilities: {
'selenium-version': '2.42.2'
},
....
environments: [
{ browserName: 'firefox' },
{ browserName: 'safari' },
{ browserName: 'chrome' }
],
Gruntfile.js
'selenium-launch': {
options: {
port: 4444,
jarDir: 'vendor/selenium/',
jar: 'selenium-server-standalone-2.42.2.jar'
}
}
Once you've got everything configured, the easisest way to run your tests is via Grunt by entering the following at the command line:
grunt test
The Intern will launch your target browsers and run the unit and functional tests. You should see something like the following:
Grunt is also configured to use the grunt-contrib-watch plugin to run all tests as you make changes to the source code or test suites in FireFox (only). To initiate this, just type the following at the command line:
grunt watch
You can also run the tests without Grunt by starting Selenium and the Intern runner manually at the commaind line with:
java -jar vendor/selenium/selenium-server-standalone-2.42.2.jar -p 4444
Then in a seperate terminal window:
./node_modules/.bin/intern-runner config=tests/intern
This can be useful if you only want to run specific suites, for example:
./node_modules/.bin/intern-runner config=tests/intern suites=tests/popover
See the Intern documentation for the complete list of parameters that you can use when running the Intern.
NOTE: The DOH tests expect the Dojo util package to be installed along with Dojo under the vendor
(see above).
The easiest way to run the DOH test suites is to link to the DOH test runner from tests/index.html
clicking the "Complete" link. You can also open it directly in a browser with:
http://host/path/to/Dojo-bootstrap/vendor/dojo/util/doh/runner.html?test=../../../../tests/complete.js
If you would like to help convert the remaining DOH unit test suites to the Intern, please note that we are trying to simultaneously update the test suites so that their test data and conditions match the Bootsrap v3 test suites. We would appreciate help with this effort.
We are also in the process of adding functional test suites to automate running tests against the existing test pages for each module. See the test suites under tests/functional
for examples.
For more on writing tests with the Intern, see the guide on the Intern wiki. The current unit test suites use the object style syntax. See the Leadfoot documentation for the commands that area available when writing functional tests.
For a step by step tutorial on getting started with the Intern, see the Intern tutorial.
- Dojo-Bootstrap Website with examples for all the modules
- Dojo Reference Guide (latest release version)
- Dojo Reference Guide (Dojo trunk)
- Bootstrap
- The Intern
- The Intern Wiki
- Intern Grunt Example
- Leadfoot documentation
Dojo Bootstrap is licensed under the Apache License 2.0