No commit activity in last 3 years
No release in over 3 years
a window sandbox for jQuery application testing with jSpec
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 2.0.0.beta

Runtime

>= 0
 Project Readme

jSpec Sandbox - a window sandbox for jQuery applications testing¶ ↑

Documentation¶ ↑

After sandbox is installed, all jQuery call is redirected in sandbox context (an iframe) and be reset after each test. You can use ‘_jQuery()’ or ‘_$()’ to call jQuery in jspec context.

Utility ‘sandbox()’ return a jQuery object from sandbox:

* sandbox() => return sandbox body
* sandbox('<p></p>') => append to sandboy body an `p' element and return it
* sandbox('my-fixture') => append a sandbox body the content of fixture file and return it (child of body element)

install with jspec command tool¶ ↑

First install [gem](gemcutter.org/) then execute:

$ sudo gem install jspec-jquery-sandbox

At which point go into your projext folder and execute:

$ echo "require 'jspec/jquery/sandbox/installable'" > spec/commands/jquery_sandbox_command.rb
$ jspec install jquerysandbox

This command add ‘jspec.jquery.sandbox.js’ and ‘jspec.jquery.sandbox.html’ files into your ‘spec/support’ folder.

After this step edit ‘dom.html’ file to require sanbox lib after jquery and add iframe with sandbox source.

...
<script src="./lib/jquery.js"></script>
<script src="./support/jspec.jquery.sandbox.js"></script>
<script>
  function runSuites() {
...
  <iframe id="sandbox" name="sandbox" src="./support/jspec.jquery.sandbox.html" style="display:none"></iframe>
</body>
...

install manually¶ ↑

Just copy ‘jspec.jquery.sandbox.js’ and ‘jspec.jquery.sandbox.html’ files lib folder to your project ‘spec/support’ folder.

After this step edit ‘dom.html’ file to require sanbox lib after jquery and add iframe with sandbox source.

...
<script src="./lib/jquery.js"></script>
<script src="./support/jspec.jquery.sandbox.js"></script>
<script>
  function runSuites() {
...
  <iframe id="sandbox" name="sandbox" src="./support/jspec.jquery.sandbox.html" style="display:none"></iframe>
</body>
...

Copyright and Licenses¶ ↑

Licensed under the MIT license (read LICENSE file). This library depends on jSpec, also licensed under the MIT licence.

  • jSpec Sandbox - Copyright © 2010 Yann Lugrin

  • jSpec - Copyright © 2010 TJ Holowaychuk