UNPKG

can

Version:

MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.

56 lines (53 loc) 2.08 kB
<html> <head> <title>require.js: Simple Bad Base Test</title> <base href="http://some.example.com/path/" /> <script type="text/javascript"> document.write('<scr' + 'ipt type="text/javascript" src="' + window.parent.doh.dohArgs.setup + '"></scr' + 'ipt>' ); document.write('<scr' + 'ipt type="text/javascript" src="' + window.parent.doh.dohArgs.dojo + '"></scr' + 'ipt>' ); </script> <script type="text/javascript"> require( // the set up script sets the base URL ["require", "simple", "dimple", "func", "doh"], function(require, simple, dimple, func) { doh.register( "simple", [ function colors(t){ t.is("blue", simple.color); t.is("dimple-blue", dimple.color); t.is("You called a function", func()); } ] ); doh.run(); } ); </script> <script type="text/javascript"> //This test is only in the HTML since it uses an URL for a require //argument. It will not work well in say, the Rhino tests. var path = location.href.replace(/simple-badbase\.html$/, "foo"), index = path.indexOf(":"), noProtocolPath = path.substring(index + 1, path.length).replace(/foo/, "bar"); require([path, noProtocolPath, "doh"], function() { doh.register( "fooBar", [ function fooBar(t){ t.is("foo", foo.name); t.is("bar", bar.name); } ] ); doh.run(); }); </script> </head> <body> <h1>require.js: Simple Test</h1> <p>You may need to change the IP address used for this test for it to work correctly.</p> <p>Check console for messages</p> </body> </html>