From 40d7e66f408eaaa66efd8d7934ab2eb3324236a1 Mon Sep 17 00:00:00 2001
From: Elliott Sprehn
Date: Sun, 24 Oct 2010 14:14:45 -0700
Subject: Lots of bug fixes in the scenario runner and a bunch of new features.
- By default the runner now creates multiple output formats as it runs. Nodes are created in the DOM with ids: json, xml, and html.
ex. $('#json').html() => json output of the runner
ex. $('#xml').html() => json output of the runner
$result is also an object tree result.
The permitted formats are html,json,xml,object.
If you don't want certain formats you can select specific ones with the new ng:scenario-output attribute on the script tag.
+
' +
+ ''
+ );
};
/**
* Gets the jQuery collection of frames. Don't use this directly because
* frames may go stale.
*
+ * @private
* @return {Object} jQuery collection
*/
-angular.scenario.Application.prototype.getFrame = function() {
- return this.context.find('> iframe');
+angular.scenario.Application.prototype.getFrame_ = function() {
+ return this.context.find('#test-frames iframe:last');
};
/**
- * Gets the window of the test runner frame. Always favor executeAction()
+ * Gets the window of the test runner frame. Always favor executeAction()
* instead of this method since it prevents you from getting a stale window.
*
+ * @private
* @return {Object} the window of the frame
*/
-angular.scenario.Application.prototype.getWindow = function() {
- var contentWindow = this.getFrame().attr('contentWindow');
+angular.scenario.Application.prototype.getWindow_ = function() {
+ var contentWindow = this.getFrame_().attr('contentWindow');
if (!contentWindow)
- throw 'No window available because frame not loaded.';
+ throw 'Frame window is not accessible.';
return contentWindow;
};
/**
* Changes the location of the frame.
+ *
+ * @param {string} url The URL. If it begins with a # then only the
+ * hash of the page is changed.
+ * @param {Function} onloadFn function($window, $document)
*/
angular.scenario.Application.prototype.navigateTo = function(url, onloadFn) {
- this.getFrame().remove();
- this.context.append('');
+ var self = this;
+ var frame = this.getFrame_();
+ if (url.charAt(0) === '#') {
+ url = frame.attr('src').split('#')[0] + url;
+ frame.attr('src', url);
+ this.executeAction(onloadFn);
+ } else {
+ frame.css('display', 'none').attr('src', 'about:blank');
+ this.context.find('#test-frames').append('