UNPKG

yadda

Version:
48 lines (42 loc) 1.47 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>QUnit Example</title> <link rel="stylesheet" href="./lib/qunit-1.10.0.css" /> <script src="../../dist/yadda-2.2.0.js"></script> <script src="./lib/qunit-1.10.0.js"></script> <script src="./bottles-library.js"></script> <script type="text/javascript"> var Yadda = require('yadda'); var FeatureParser = Yadda.parsers.FeatureParser; function runTests() { var text = document.getElementById('scenarios').innerText; var scenarios = new FeatureParser().parse(text).scenarios; for (var i = 0; i < scenarios.length; i++) { var scenario = scenarios[i]; test(scenario.title, buildTest(scenario)); function buildTest(scenario) { return function () { Yadda.createInstance(library).run(scenario.steps); }; } } } </script> </head> <body onLoad="runTests()"> <div id="qunit"></div> <pre id="scenarios"> Scenario: A bottle falls from the wall Given 100 green bottles are standing on the wall when 1 green bottle accidentally falls then there are 99 green bottles standing on the wall Scenario: No bottles are left Given 1 green bottles are standing on the wall when 1 green bottle accidentally falls then there are 0 green bottles standing on the wall </pre > </body> </html>