Sha256: f9d4251c06d36a5cdcf5a479f9803bf4f9e79192657180647d1209363ab80538

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

// ==========================================================================
// Project:   SproutCore Unit Testing Library
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2009 Apple, Inc. All rights reserved.
// License:   Licened under MIT license (see license.js)
// ==========================================================================

/*global Q$ synchronize */
// additional methods for use with qunit

/**
  Converts the passed string into HTML and then appends it to the main body 
  element.  This is a useful way to automatically load fixture HTML into the
  main page.
*/
function htmlbody(string) {
  synchronize(function() {
    var html = Q$(string) ;
    var body = Q$('body')[0];
    
    // first, find the first element with id 'htmlbody-begin'  if exists,
    // remove everything after that to reset...
    var begin = Q$('body #htmlbody-begin')[0];
    if (!begin) {
      begin = Q$('<div id="htmlbody-begin"></div>')[0];
      body.appendChild(begin);
    } else {
      while(begin.nextSibling) body.removeChild(begin.nextSibling);
    }
    begin = null; 
    
    // now append new content
    html.each(function() { body.appendChild(this); });
  }) ;
}

/**
  Call this method instead of test() to temporarily disable a test. 
*/
function notest(name, callback, nowait) {
  
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090408130025 frameworks/sproutcore/frameworks/testing/extras.js
sproutit-sproutcore-1.0.0.20090416161445 frameworks/sproutcore/frameworks/testing/extras.js