소스 검색

AMBARI-8533. Views: Pig View Usability (alexantonenko)

Alex Antonenko 10 년 전
부모
커밋
f7414a762c
52개의 변경된 파일4450개의 추가작업 그리고 145개의 파일을 삭제
  1. 2 0
      ambari-web/app/assets/licenses/NOTICE.txt
  2. 266 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/ember-qunit.js
  3. 692 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/jquery.mockjax.js
  4. 3 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/modernizr-2.6.2.min.js
  5. 2495 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/qunit.js
  6. 29 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/tests.js
  7. 237 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/stylesheets/qunit.css
  8. 46 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/assets/tests.html
  9. 38 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/components/codeMirror.js
  10. 1 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/components/jobProgress.js
  11. 2 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/components/pigHelper.js
  12. 1 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmAway.js
  13. 15 16
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createScript.js
  14. 2 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createUdf.js
  15. 28 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteUdf.js
  16. 7 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/pigModal.js
  17. 2 6
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js
  18. 1 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js
  19. 1 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigScripts.js
  20. 7 9
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigUdfs.js
  21. 12 7
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/script.js
  22. 12 8
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
  23. 4 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptJob.js
  24. 1 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js
  25. 4 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js
  26. 2 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/fileHandler.js
  27. 2 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/pagination.js
  28. 1 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/models/file.js
  29. 1 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_job.js
  30. 6 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_script.js
  31. 3 3
      contrib/views/pig/src/main/resources/ui/pig-web/app/routes/script.js
  32. 1 3
      contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptJob.js
  33. 116 19
      contrib/views/pig/src/main/resources/ui/pig-web/app/styles/style.less
  34. 6 6
      contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createScript.hbs
  35. 2 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createUdf.hbs
  36. 31 0
      contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteUdf.hbs
  37. 7 7
      contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig.hbs
  38. 1 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/udfs.hbs
  39. 11 7
      contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/edit.hbs
  40. 12 5
      contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
  41. 5 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js
  42. 2 2
      contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/history.js
  43. 12 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/edit.js
  44. 13 1
      contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/job.js
  45. 12 0
      contrib/views/pig/src/main/resources/ui/pig-web/bower.json
  46. 3 1
      contrib/views/pig/src/main/resources/ui/pig-web/config.coffee
  47. 7 0
      contrib/views/pig/src/main/resources/ui/pig-web/package.json
  48. 136 0
      contrib/views/pig/src/main/resources/ui/pig-web/runner.js
  49. 0 17
      contrib/views/pig/src/main/resources/ui/pig-web/test/spec.coffee
  50. 37 0
      contrib/views/pig/src/main/resources/ui/pig-web/test/unit/controllers/pig_test.js
  51. 110 0
      contrib/views/pig/src/main/resources/ui/pig-web/vendor/pig-hint.js
  52. 3 0
      pom.xml

+ 2 - 0
ambari-web/app/assets/licenses/NOTICE.txt

@@ -43,3 +43,5 @@ This product includes Spin.js (http://fgnass.github.com/spin.js/ - MIT license)
 Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de]
 
 This product includes Moment.js (https://github.com/moment/moment/ - MIT license)
+
+This product includes Ember QUnit (https://github.com/rwjblue/ember-qunit - MIT license)

+ 266 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/ember-qunit.js

@@ -0,0 +1,266 @@
+!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.emq=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
+"use strict";
+var testResolver = _dereq_("./test-resolver")["default"] || _dereq_("./test-resolver");
+var Ember = window.Ember["default"] || window.Ember;
+
+exports["default"] = function isolatedContainer(fullNames) {
+  var resolver = testResolver.get();
+  var container = new Ember.Container();
+  container.optionsForType('component', { singleton: false });
+  container.optionsForType('view', { singleton: false });
+  container.optionsForType('template', { instantiate: false });
+  container.optionsForType('helper', { instantiate: false });
+  container.register('component-lookup:main', Ember.ComponentLookup);
+  for (var i = fullNames.length; i > 0; i--) {
+    var fullName = fullNames[i - 1];
+    container.register(fullName, resolver.resolve(fullName));
+  }
+  return container;
+}
+},{"./test-resolver":7}],2:[function(_dereq_,module,exports){
+"use strict";
+var Ember = window.Ember["default"] || window.Ember;
+var isolatedContainer = _dereq_("./isolated-container")["default"] || _dereq_("./isolated-container");
+var moduleFor = _dereq_("./module-for")["default"] || _dereq_("./module-for");
+var moduleForComponent = _dereq_("./module-for-component")["default"] || _dereq_("./module-for-component");
+var moduleForModel = _dereq_("./module-for-model")["default"] || _dereq_("./module-for-model");
+var test = _dereq_("./test")["default"] || _dereq_("./test");
+var testResolver = _dereq_("./test-resolver")["default"] || _dereq_("./test-resolver");
+
+Ember.testing = true;
+
+function setResolver(resolver) {
+  testResolver.set(resolver);
+}
+
+function globalize() {
+  window.moduleFor = moduleFor;
+  window.moduleForComponent = moduleForComponent;
+  window.moduleForModel = moduleForModel;
+  window.test = test;
+  window.setResolver = setResolver;
+}
+
+exports.globalize = globalize;
+exports.moduleFor = moduleFor;
+exports.moduleForComponent = moduleForComponent;
+exports.moduleForModel = moduleForModel;
+exports.test = test;
+exports.setResolver = setResolver;
+},{"./isolated-container":1,"./module-for":5,"./module-for-component":3,"./module-for-model":4,"./test":8,"./test-resolver":7}],3:[function(_dereq_,module,exports){
+"use strict";
+var testResolver = _dereq_("./test-resolver")["default"] || _dereq_("./test-resolver");
+var moduleFor = _dereq_("./module-for")["default"] || _dereq_("./module-for");
+var Ember = window.Ember["default"] || window.Ember;
+
+exports["default"] = function moduleForComponent(name, description, callbacks) {
+  var resolver = testResolver.get();
+
+  moduleFor('component:' + name, description, callbacks, function(container, context, defaultSubject) {
+    var layoutName = 'template:components/' + name;
+
+    var layout = resolver.resolve(layoutName);
+
+    if (layout) {
+      container.register(layoutName, layout);
+      container.injection('component:' + name, 'layout', layoutName);
+    }
+
+    context.dispatcher = Ember.EventDispatcher.create();
+    context.dispatcher.setup({}, '#ember-testing');
+
+    context.__setup_properties__.append = function(selector) {
+      var containerView = Ember.ContainerView.create({container: container});
+      var view = Ember.run(function(){
+        var subject = context.subject();
+        containerView.pushObject(subject);
+        // TODO: destory this somewhere
+        containerView.appendTo('#ember-testing');
+        return subject;
+      });
+
+      return view.$();
+    };
+    context.__setup_properties__.$ = context.__setup_properties__.append;
+  });
+}
+},{"./module-for":5,"./test-resolver":7}],4:[function(_dereq_,module,exports){
+"use strict";
+var moduleFor = _dereq_("./module-for")["default"] || _dereq_("./module-for");
+var Ember = window.Ember["default"] || window.Ember;
+
+exports["default"] = function moduleForModel(name, description, callbacks) {
+  moduleFor('model:' + name, description, callbacks, function(container, context, defaultSubject) {
+    if (DS._setupContainer) {
+      DS._setupContainer(container);
+    } else {
+      container.register('store:main', DS.Store);
+    }
+
+    var adapterFactory = container.lookupFactory('adapter:application');
+    if (!adapterFactory) {
+      container.register('adapter:application', DS.FixtureAdapter);
+    }
+
+    context.__setup_properties__.store = function(){
+      return container.lookup('store:main');
+    };
+
+    if (context.__setup_properties__.subject === defaultSubject) {
+      context.__setup_properties__.subject = function(options) {
+        return Ember.run(function() {
+          return container.lookup('store:main').createRecord(name, options);
+        });
+      };
+    }
+  });
+}
+},{"./module-for":5}],5:[function(_dereq_,module,exports){
+"use strict";
+var Ember = window.Ember["default"] || window.Ember;
+//import QUnit from 'qunit'; // Assumed global in runner
+var testContext = _dereq_("./test-context")["default"] || _dereq_("./test-context");
+var isolatedContainer = _dereq_("./isolated-container")["default"] || _dereq_("./isolated-container");
+
+exports["default"] = function moduleFor(fullName, description, callbacks, delegate) {
+  var container;
+  var context;
+
+  var _callbacks = {
+    setup: function(){
+      callbacks = callbacks || { };
+
+      var needs = [fullName].concat(callbacks.needs || []);
+      container = isolatedContainer(needs);
+
+      callbacks.subject   = callbacks.subject || defaultSubject;
+
+      callbacks.setup     = callbacks.setup    || function() { };
+      callbacks.teardown  = callbacks.teardown || function() { };
+
+      function factory() {
+        return container.lookupFactory(fullName);
+      }
+
+      testContext.set({
+        container:            container,
+        factory:              factory,
+        dispatcher:           null,
+        __setup_properties__: callbacks
+      });
+
+      context = testContext.get();
+
+      if (delegate) {
+        delegate(container, context, defaultSubject);
+      }
+
+      if (Ember.$('#ember-testing').length === 0) {
+        Ember.$('<div id="ember-testing"/>').appendTo(document.body);
+      }
+
+      buildContextVariables(context);
+      callbacks.setup.call(context, container);
+    },
+
+    teardown: function(){
+      Ember.run(function(){
+        container.destroy();
+
+        if (context.dispatcher) {
+          context.dispatcher.destroy();
+        }
+      });
+
+      callbacks.teardown(container);
+      Ember.$('#ember-testing').empty();
+    }
+  };
+
+  QUnit.module(description || fullName, _callbacks);
+}
+
+function defaultSubject(options, factory) {
+  return factory.create(options);
+}
+
+// allow arbitrary named factories, like rspec let
+function buildContextVariables(context) {
+  var cache     = { };
+  var callbacks = context.__setup_properties__;
+  var container = context.container;
+  var factory   = context.factory;
+
+  Ember.keys(callbacks).filter(function(key){
+    // ignore the default setup/teardown keys
+    return key !== 'setup' && key !== 'teardown';
+  }).forEach(function(key){
+    context[key] = function(options) {
+      if (cache[key]) { return cache[key]; }
+
+      var result = callbacks[key](options, factory(), container);
+      cache[key] = result;
+      return result;
+    };
+  });
+}
+},{"./isolated-container":1,"./test-context":6}],6:[function(_dereq_,module,exports){
+"use strict";
+var __test_context__;
+
+function set(context) {
+  __test_context__ = context;
+}
+
+exports.set = set;function get() {
+  return __test_context__;
+}
+
+exports.get = get;
+},{}],7:[function(_dereq_,module,exports){
+"use strict";
+var __resolver__;
+
+function set(resolver) {
+  __resolver__ = resolver;
+}
+
+exports.set = set;function get() {
+  if (__resolver__ == null) throw new Error('you must set a resolver with `testResolver.set(resolver)`');
+  return __resolver__;
+}
+
+exports.get = get;
+},{}],8:[function(_dereq_,module,exports){
+"use strict";
+var Ember = window.Ember["default"] || window.Ember;
+//import QUnit from 'qunit'; // Assumed global in runner
+var testContext = _dereq_("./test-context")["default"] || _dereq_("./test-context");
+
+function resetViews() {
+  Ember.View.views = {};
+}
+
+exports["default"] = function test(testName, callback) {
+
+  function wrapper() {
+    var context = testContext.get();
+
+    resetViews();
+    var result = callback.call(context);
+
+    function failTestOnPromiseRejection(reason) {
+      ok(false, reason);
+    }
+
+    Ember.run(function(){
+      stop();
+      Ember.RSVP.Promise.cast(result)['catch'](failTestOnPromiseRejection)['finally'](start);
+    });
+  }
+
+  QUnit.test(testName, wrapper);
+}
+},{"./test-context":6}]},{},[2])
+(2)
+});

+ 692 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/jquery.mockjax.js

@@ -0,0 +1,692 @@
+/*!
+ * MockJax - jQuery Plugin to Mock Ajax requests
+ *
+ * Version:  1.6.0
+ * Released:
+ * Home:   https://github.com/jakerella/jquery-mockjax
+ * Author:   Jonathan Sharp (http://jdsharp.com)
+ * License:  MIT,GPL
+ *
+ * Copyright (c) 2014 appendTo, Jordan Kasper
+ * NOTE: This repository was taken over by Jordan Kasper (@jakerella) October, 2014
+ *
+ * Dual licensed under the MIT or GPL licenses.
+ * http://opensource.org/licenses/MIT OR http://www.gnu.org/licenses/gpl-2.0.html
+ */
+(function($) {
+  var _ajax = $.ajax,
+    mockHandlers = [],
+    mockedAjaxCalls = [],
+    unmockedAjaxCalls = [],
+    CALLBACK_REGEX = /=\?(&|$)/,
+    jsc = (new Date()).getTime();
+
+
+  // Parse the given XML string.
+  function parseXML(xml) {
+    if ( window.DOMParser == undefined && window.ActiveXObject ) {
+      DOMParser = function() { };
+      DOMParser.prototype.parseFromString = function( xmlString ) {
+        var doc = new ActiveXObject('Microsoft.XMLDOM');
+        doc.async = 'false';
+        doc.loadXML( xmlString );
+        return doc;
+      };
+    }
+
+    try {
+      var xmlDoc = ( new DOMParser() ).parseFromString( xml, 'text/xml' );
+      if ( $.isXMLDoc( xmlDoc ) ) {
+        var err = $('parsererror', xmlDoc);
+        if ( err.length == 1 ) {
+          throw new Error('Error: ' + $(xmlDoc).text() );
+        }
+      } else {
+        throw new Error('Unable to parse XML');
+      }
+      return xmlDoc;
+    } catch( e ) {
+      var msg = ( e.name == undefined ? e : e.name + ': ' + e.message );
+      $(document).trigger('xmlParseError', [ msg ]);
+      return undefined;
+    }
+  }
+
+  // Check if the data field on the mock handler and the request match. This
+  // can be used to restrict a mock handler to being used only when a certain
+  // set of data is passed to it.
+  function isMockDataEqual( mock, live ) {
+    var identical = true;
+    // Test for situations where the data is a querystring (not an object)
+    if (typeof live === 'string') {
+      // Querystring may be a regex
+      return $.isFunction( mock.test ) ? mock.test(live) : mock == live;
+    }
+    $.each(mock, function(k) {
+      if ( live[k] === undefined ) {
+        identical = false;
+        return identical;
+      } else {
+        if ( typeof live[k] === 'object' && live[k] !== null ) {
+          if ( identical && $.isArray( live[k] ) ) {
+            identical = $.isArray( mock[k] ) && live[k].length === mock[k].length;
+          }
+          identical = identical && isMockDataEqual(mock[k], live[k]);
+        } else {
+          if ( mock[k] && $.isFunction( mock[k].test ) ) {
+            identical = identical && mock[k].test(live[k]);
+          } else {
+            identical = identical && ( mock[k] == live[k] );
+          }
+        }
+      }
+    });
+
+    return identical;
+  }
+
+  // See if a mock handler property matches the default settings
+  function isDefaultSetting(handler, property) {
+    return handler[property] === $.mockjaxSettings[property];
+  }
+
+  // Check the given handler should mock the given request
+  function getMockForRequest( handler, requestSettings ) {
+    // If the mock was registered with a function, let the function decide if we
+    // want to mock this request
+    if ( $.isFunction(handler) ) {
+      return handler( requestSettings );
+    }
+
+    // Inspect the URL of the request and check if the mock handler's url
+    // matches the url for this ajax request
+    if ( $.isFunction(handler.url.test) ) {
+      // The user provided a regex for the url, test it
+      if ( !handler.url.test( requestSettings.url ) ) {
+        return null;
+      }
+    } else {
+      // Look for a simple wildcard '*' or a direct URL match
+      var star = handler.url.indexOf('*');
+      if (handler.url !== requestSettings.url && star === -1 ||
+        !new RegExp(handler.url.replace(/[-[\]{}()+?.,\\^$|#\s]/g, "\\$&").replace(/\*/g, '.+')).test(requestSettings.url)) {
+        return null;
+      }
+    }
+
+    // Inspect the data submitted in the request (either POST body or GET query string)
+    if ( handler.data ) {
+      if ( ! requestSettings.data || !isMockDataEqual(handler.data, requestSettings.data) ) {
+        // They're not identical, do not mock this request
+        return null;
+      }
+    }
+    // Inspect the request type
+    if ( handler && handler.type &&
+      handler.type.toLowerCase() != requestSettings.type.toLowerCase() ) {
+      // The request type doesn't match (GET vs. POST)
+      return null;
+    }
+
+    return handler;
+  }
+
+  function parseResponseTimeOpt(responseTime) {
+    if ($.isArray(responseTime)) {
+      var min = responseTime[0];
+      var max = responseTime[1];
+      return (typeof min === 'number' && typeof max === 'number') ? Math.floor(Math.random() * (max - min)) + min : null;
+    } else {
+      return (typeof responseTime === 'number') ? responseTime: null;
+    }
+  }
+
+  // Process the xhr objects send operation
+  function _xhrSend(mockHandler, requestSettings, origSettings) {
+
+    // This is a substitute for < 1.4 which lacks $.proxy
+    var process = (function(that) {
+      return function() {
+        return (function() {
+          // The request has returned
+          this.status     = mockHandler.status;
+          this.statusText = mockHandler.statusText;
+          this.readyState	= 1;
+
+          var finishRequest = function () {
+            this.readyState	= 4;
+
+            var onReady;
+            // Copy over our mock to our xhr object before passing control back to
+            // jQuery's onreadystatechange callback
+            if ( requestSettings.dataType == 'json' && ( typeof mockHandler.responseText == 'object' ) ) {
+              this.responseText = JSON.stringify(mockHandler.responseText);
+            } else if ( requestSettings.dataType == 'xml' ) {
+              if ( typeof mockHandler.responseXML == 'string' ) {
+                this.responseXML = parseXML(mockHandler.responseXML);
+                //in jQuery 1.9.1+, responseXML is processed differently and relies on responseText
+                this.responseText = mockHandler.responseXML;
+              } else {
+                this.responseXML = mockHandler.responseXML;
+              }
+            } else if (typeof mockHandler.responseText === 'object' && mockHandler.responseText !== null) {
+              // since jQuery 1.9 responseText type has to match contentType
+              mockHandler.contentType = 'application/json';
+              this.responseText = JSON.stringify(mockHandler.responseText);
+            } else {
+              this.responseText = mockHandler.responseText;
+            }
+            if( typeof mockHandler.status == 'number' || typeof mockHandler.status == 'string' ) {
+              this.status = mockHandler.status;
+            }
+            if( typeof mockHandler.statusText === "string") {
+              this.statusText = mockHandler.statusText;
+            }
+            // jQuery 2.0 renamed onreadystatechange to onload
+            onReady = this.onreadystatechange || this.onload;
+
+            // jQuery < 1.4 doesn't have onreadystate change for xhr
+            if ( $.isFunction( onReady ) ) {
+              if( mockHandler.isTimeout) {
+                this.status = -1;
+              }
+              onReady.call( this, mockHandler.isTimeout ? 'timeout' : undefined );
+            } else if ( mockHandler.isTimeout ) {
+              // Fix for 1.3.2 timeout to keep success from firing.
+              this.status = -1;
+            }
+          };
+
+          // We have an executable function, call it to give
+          // the mock handler a chance to update it's data
+          if ( $.isFunction(mockHandler.response) ) {
+            // Wait for it to finish
+            if ( mockHandler.response.length === 2 ) {
+              mockHandler.response(origSettings, function () {
+                finishRequest.call(that);
+              });
+              return;
+            } else {
+              mockHandler.response(origSettings);
+            }
+          }
+
+          finishRequest.call(that);
+        }).apply(that);
+      };
+    })(this);
+
+    if ( mockHandler.proxy ) {
+      // We're proxying this request and loading in an external file instead
+      _ajax({
+        global: false,
+        url: mockHandler.proxy,
+        type: mockHandler.proxyType,
+        data: mockHandler.data,
+        dataType: requestSettings.dataType === "script" ? "text/plain" : requestSettings.dataType,
+        complete: function(xhr) {
+          mockHandler.responseXML = xhr.responseXML;
+          mockHandler.responseText = xhr.responseText;
+          // Don't override the handler status/statusText if it's specified by the config
+          if (isDefaultSetting(mockHandler, 'status')) {
+            mockHandler.status = xhr.status;
+          }
+          if (isDefaultSetting(mockHandler, 'statusText')) {
+            mockHandler.statusText = xhr.statusText;
+          }
+          this.responseTimer = setTimeout(process, parseResponseTimeOpt(mockHandler.responseTime) || 0);
+        }
+      });
+    } else {
+      // type == 'POST' || 'GET' || 'DELETE'
+      if ( requestSettings.async === false ) {
+        // TODO: Blocking delay
+        process();
+      } else {
+        this.responseTimer = setTimeout(process, parseResponseTimeOpt(mockHandler.responseTime) || 50);
+      }
+    }
+  }
+
+  // Construct a mocked XHR Object
+  function xhr(mockHandler, requestSettings, origSettings, origHandler) {
+    // Extend with our default mockjax settings
+    mockHandler = $.extend(true, {}, $.mockjaxSettings, mockHandler);
+
+    if (typeof mockHandler.headers === 'undefined') {
+      mockHandler.headers = {};
+    }
+    if (typeof requestSettings.headers === 'undefined') {
+      requestSettings.headers = {};
+    }
+    if ( mockHandler.contentType ) {
+      mockHandler.headers['content-type'] = mockHandler.contentType;
+    }
+
+    return {
+      status: mockHandler.status,
+      statusText: mockHandler.statusText,
+      readyState: 1,
+      open: function() { },
+      send: function() {
+        origHandler.fired = true;
+        _xhrSend.call(this, mockHandler, requestSettings, origSettings);
+      },
+      abort: function() {
+        clearTimeout(this.responseTimer);
+      },
+      setRequestHeader: function(header, value) {
+        requestSettings.headers[header] = value;
+      },
+      getResponseHeader: function(header) {
+        // 'Last-modified', 'Etag', 'content-type' are all checked by jQuery
+        if ( mockHandler.headers && mockHandler.headers[header] ) {
+          // Return arbitrary headers
+          return mockHandler.headers[header];
+        } else if ( header.toLowerCase() == 'last-modified' ) {
+          return mockHandler.lastModified || (new Date()).toString();
+        } else if ( header.toLowerCase() == 'etag' ) {
+          return mockHandler.etag || '';
+        } else if ( header.toLowerCase() == 'content-type' ) {
+          return mockHandler.contentType || 'text/plain';
+        }
+      },
+      getAllResponseHeaders: function() {
+        var headers = '';
+        // since jQuery 1.9 responseText type has to match contentType
+        if (mockHandler.contentType) {
+          mockHandler.headers['Content-Type'] = mockHandler.contentType;
+        }
+        $.each(mockHandler.headers, function(k, v) {
+          headers += k + ': ' + v + "\n";
+        });
+        return headers;
+      }
+    };
+  }
+
+  // Process a JSONP mock request.
+  function processJsonpMock( requestSettings, mockHandler, origSettings ) {
+    // Handle JSONP Parameter Callbacks, we need to replicate some of the jQuery core here
+    // because there isn't an easy hook for the cross domain script tag of jsonp
+
+    processJsonpUrl( requestSettings );
+
+    requestSettings.dataType = "json";
+    if(requestSettings.data && CALLBACK_REGEX.test(requestSettings.data) || CALLBACK_REGEX.test(requestSettings.url)) {
+      createJsonpCallback(requestSettings, mockHandler, origSettings);
+
+      // We need to make sure
+      // that a JSONP style response is executed properly
+
+      var rurl = /^(\w+:)?\/\/([^\/?#]+)/,
+        parts = rurl.exec( requestSettings.url ),
+        remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
+
+      requestSettings.dataType = "script";
+      if(requestSettings.type.toUpperCase() === "GET" && remote ) {
+        var newMockReturn = processJsonpRequest( requestSettings, mockHandler, origSettings );
+
+        // Check if we are supposed to return a Deferred back to the mock call, or just
+        // signal success
+        if(newMockReturn) {
+          return newMockReturn;
+        } else {
+          return true;
+        }
+      }
+    }
+    return null;
+  }
+
+  // Append the required callback parameter to the end of the request URL, for a JSONP request
+  function processJsonpUrl( requestSettings ) {
+    if ( requestSettings.type.toUpperCase() === "GET" ) {
+      if ( !CALLBACK_REGEX.test( requestSettings.url ) ) {
+        requestSettings.url += (/\?/.test( requestSettings.url ) ? "&" : "?") +
+          (requestSettings.jsonp || "callback") + "=?";
+      }
+    } else if ( !requestSettings.data || !CALLBACK_REGEX.test(requestSettings.data) ) {
+      requestSettings.data = (requestSettings.data ? requestSettings.data + "&" : "") + (requestSettings.jsonp || "callback") + "=?";
+    }
+  }
+
+  // Process a JSONP request by evaluating the mocked response text
+  function processJsonpRequest( requestSettings, mockHandler, origSettings ) {
+    // Synthesize the mock request for adding a script tag
+    var callbackContext = origSettings && origSettings.context || requestSettings,
+      newMock = null;
+
+
+    // If the response handler on the moock is a function, call it
+    if ( mockHandler.response && $.isFunction(mockHandler.response) ) {
+      mockHandler.response(origSettings);
+    } else {
+
+      // Evaluate the responseText javascript in a global context
+      if( typeof mockHandler.responseText === 'object' ) {
+        $.globalEval( '(' + JSON.stringify( mockHandler.responseText ) + ')');
+      } else {
+        $.globalEval( '(' + mockHandler.responseText + ')');
+      }
+    }
+
+    // Successful response
+    setTimeout(function() {
+      jsonpSuccess( requestSettings, callbackContext, mockHandler );
+      jsonpComplete( requestSettings, callbackContext, mockHandler );
+    }, parseResponseTimeOpt(mockHandler.responseTime) || 0);
+
+    // If we are running under jQuery 1.5+, return a deferred object
+    if($.Deferred){
+      newMock = new $.Deferred();
+      if(typeof mockHandler.responseText == "object"){
+        newMock.resolveWith( callbackContext, [mockHandler.responseText] );
+      }
+      else{
+        newMock.resolveWith( callbackContext, [$.parseJSON( mockHandler.responseText )] );
+      }
+    }
+    return newMock;
+  }
+
+
+  // Create the required JSONP callback function for the request
+  function createJsonpCallback( requestSettings, mockHandler, origSettings ) {
+    var callbackContext = origSettings && origSettings.context || requestSettings;
+    var jsonp = requestSettings.jsonpCallback || ("jsonp" + jsc++);
+
+    // Replace the =? sequence both in the query string and the data
+    if ( requestSettings.data ) {
+      requestSettings.data = (requestSettings.data + "").replace(CALLBACK_REGEX, "=" + jsonp + "$1");
+    }
+
+    requestSettings.url = requestSettings.url.replace(CALLBACK_REGEX, "=" + jsonp + "$1");
+
+
+    // Handle JSONP-style loading
+    window[ jsonp ] = window[ jsonp ] || function( tmp ) {
+      data = tmp;
+      jsonpSuccess( requestSettings, callbackContext, mockHandler );
+      jsonpComplete( requestSettings, callbackContext, mockHandler );
+      // Garbage collect
+      window[ jsonp ] = undefined;
+
+      try {
+        delete window[ jsonp ];
+      } catch(e) {}
+
+      if ( head ) {
+        head.removeChild( script );
+      }
+    };
+  }
+
+  // The JSONP request was successful
+  function jsonpSuccess(requestSettings, callbackContext, mockHandler) {
+    // If a local callback was specified, fire it and pass it the data
+    if ( requestSettings.success ) {
+      requestSettings.success.call( callbackContext, mockHandler.responseText || "", status, {} );
+    }
+
+    // Fire the global callback
+    if ( requestSettings.global ) {
+      (requestSettings.context ? $(requestSettings.context) : $.event).trigger("ajaxSuccess", [{}, requestSettings]);
+    }
+  }
+
+  // The JSONP request was completed
+  function jsonpComplete(requestSettings, callbackContext) {
+    // Process result
+    if ( requestSettings.complete ) {
+      requestSettings.complete.call( callbackContext, {} , status );
+    }
+
+    // The request was completed
+    if ( requestSettings.global ) {
+      (requestSettings.context ? $(requestSettings.context) : $.event).trigger("ajaxComplete", [{}, requestSettings]);
+    }
+
+    // Handle the global AJAX counter
+    if ( requestSettings.global && ! --$.active ) {
+      $.event.trigger( "ajaxStop" );
+    }
+  }
+
+
+  // The core $.ajax replacement.
+  function handleAjax( url, origSettings ) {
+    var mockRequest, requestSettings, mockHandler, overrideCallback;
+
+    // If url is an object, simulate pre-1.5 signature
+    if ( typeof url === "object" ) {
+      origSettings = url;
+      url = undefined;
+    } else {
+      // work around to support 1.5 signature
+      origSettings = origSettings || {};
+      origSettings.url = url;
+    }
+
+    // Extend the original settings for the request
+    requestSettings = $.extend(true, {}, $.ajaxSettings, origSettings);
+
+    // Generic function to override callback methods for use with
+    // callback options (onAfterSuccess, onAfterError, onAfterComplete)
+    overrideCallback = function(action, mockHandler) {
+      var origHandler = origSettings[action.toLowerCase()];
+      return function() {
+        if ( $.isFunction(origHandler) ) {
+          origHandler.apply(this, [].slice.call(arguments));
+        }
+        mockHandler['onAfter' + action]();
+      };
+    };
+
+    // Iterate over our mock handlers (in registration order) until we find
+    // one that is willing to intercept the request
+    for(var k = 0; k < mockHandlers.length; k++) {
+      if ( !mockHandlers[k] ) {
+        continue;
+      }
+
+      mockHandler = getMockForRequest( mockHandlers[k], requestSettings );
+      if(!mockHandler) {
+        // No valid mock found for this request
+        continue;
+      }
+
+      mockedAjaxCalls.push(requestSettings);
+
+      // If logging is enabled, log the mock to the console
+      $.mockjaxSettings.log( mockHandler, requestSettings );
+
+
+      if ( requestSettings.dataType && requestSettings.dataType.toUpperCase() === 'JSONP' ) {
+        if ((mockRequest = processJsonpMock( requestSettings, mockHandler, origSettings ))) {
+          // This mock will handle the JSONP request
+          return mockRequest;
+        }
+      }
+
+
+      // Removed to fix #54 - keep the mocking data object intact
+      //mockHandler.data = requestSettings.data;
+
+      mockHandler.cache = requestSettings.cache;
+      mockHandler.timeout = requestSettings.timeout;
+      mockHandler.global = requestSettings.global;
+
+      // In the case of a timeout, we just need to ensure
+      // an actual jQuery timeout (That is, our reponse won't)
+      // return faster than the timeout setting.
+      if ( mockHandler.isTimeout ) {
+        if ( mockHandler.responseTime > 1 ) {
+          origSettings.timeout = mockHandler.responseTime - 1;
+        } else {
+          mockHandler.responseTime = 2;
+          origSettings.timeout = 1;
+        }
+        mockHandler.isTimeout = false;
+      }
+
+      // Set up onAfter[X] callback functions
+      if ( $.isFunction( mockHandler.onAfterSuccess ) ) {
+        origSettings.success = overrideCallback('Success', mockHandler);
+      }
+      if ( $.isFunction( mockHandler.onAfterError ) ) {
+        origSettings.error = overrideCallback('Error', mockHandler);
+      }
+      if ( $.isFunction( mockHandler.onAfterComplete ) ) {
+        origSettings.complete = overrideCallback('Complete', mockHandler);
+      }
+
+      copyUrlParameters(mockHandler, origSettings);
+
+      (function(mockHandler, requestSettings, origSettings, origHandler) {
+
+        mockRequest = _ajax.call($, $.extend(true, {}, origSettings, {
+          // Mock the XHR object
+          xhr: function() { return xhr( mockHandler, requestSettings, origSettings, origHandler ); }
+        }));
+      })(mockHandler, requestSettings, origSettings, mockHandlers[k]);
+
+      return mockRequest;
+    }
+
+    // We don't have a mock request
+    unmockedAjaxCalls.push(origSettings);
+    if($.mockjaxSettings.throwUnmocked === true) {
+      throw new Error('AJAX not mocked: ' + origSettings.url);
+    }
+    else { // trigger a normal request
+      return _ajax.apply($, [origSettings]);
+    }
+  }
+
+  /**
+   * Copies URL parameter values if they were captured by a regular expression
+   * @param {Object} mockHandler
+   * @param {Object} origSettings
+   */
+  function copyUrlParameters(mockHandler, origSettings) {
+    //parameters aren't captured if the URL isn't a RegExp
+    if (!(mockHandler.url instanceof RegExp)) {
+      return;
+    }
+    //if no URL params were defined on the handler, don't attempt a capture
+    if (!mockHandler.hasOwnProperty('urlParams')) {
+      return;
+    }
+    var captures = mockHandler.url.exec(origSettings.url);
+    //the whole RegExp match is always the first value in the capture results
+    if (captures.length === 1) {
+      return;
+    }
+    captures.shift();
+    //use handler params as keys and capture resuts as values
+    var i = 0,
+      capturesLength = captures.length,
+      paramsLength = mockHandler.urlParams.length,
+    //in case the number of params specified is less than actual captures
+      maxIterations = Math.min(capturesLength, paramsLength),
+      paramValues = {};
+    for (i; i < maxIterations; i++) {
+      var key = mockHandler.urlParams[i];
+      paramValues[key] = captures[i];
+    }
+    origSettings.urlParams = paramValues;
+  }
+
+
+  // Public
+
+  $.extend({
+    ajax: handleAjax
+  });
+
+  $.mockjaxSettings = {
+    //url:        null,
+    //type:       'GET',
+    log:          function( mockHandler, requestSettings ) {
+      if ( mockHandler.logging === false ||
+        ( typeof mockHandler.logging === 'undefined' && $.mockjaxSettings.logging === false ) ) {
+        return;
+      }
+      if ( window.console && console.log ) {
+        var message = 'MOCK ' + requestSettings.type.toUpperCase() + ': ' + requestSettings.url;
+        var request = $.extend({}, requestSettings);
+
+        if (typeof console.log === 'function') {
+          console.log(message, request);
+        } else {
+          try {
+            console.log( message + ' ' + JSON.stringify(request) );
+          } catch (e) {
+            console.log(message);
+          }
+        }
+      }
+    },
+    logging:       true,
+    status:        200,
+    statusText:    "OK",
+    responseTime:  500,
+    isTimeout:     false,
+    throwUnmocked: false,
+    contentType:   'text/plain',
+    response:      '',
+    responseText:  '',
+    responseXML:   '',
+    proxy:         '',
+    proxyType:     'GET',
+
+    lastModified:  null,
+    etag:          '',
+    headers: {
+      etag: 'IJF@H#@923uf8023hFO@I#H#',
+      'content-type' : 'text/plain'
+    }
+  };
+
+  $.mockjax = function(settings) {
+    var i = mockHandlers.length;
+    mockHandlers[i] = settings;
+    return i;
+  };
+  $.mockjax.clear = function(i) {
+    if ( arguments.length == 1 ) {
+      mockHandlers[i] = null;
+    } else {
+      mockHandlers = [];
+    }
+    mockedAjaxCalls = [];
+    unmockedAjaxCalls = [];
+  };
+  // support older, deprecated version
+  $.mockjaxClear = function(i) {
+    window.console && window.console.warn && window.console.warn( 'DEPRECATED: The $.mockjaxClear() method has been deprecated in 1.6.0. Please use $.mockjax.clear() as the older function will be removed soon!' );
+    $.mockjax.clear();
+  };
+  $.mockjax.handler = function(i) {
+    if ( arguments.length == 1 ) {
+      return mockHandlers[i];
+    }
+  };
+  $.mockjax.mockedAjaxCalls = function() {
+    return mockedAjaxCalls;
+  };
+  $.mockjax.unfiredHandlers = function() {
+    var results = [];
+    for (var i=0, len=mockHandlers.length; i<len; i++) {
+      var handler = mockHandlers[i];
+      if (handler !== null && !handler.fired) {
+        results.push(handler);
+      }
+    }
+    return results;
+  };
+  $.mockjax.unmockedAjaxCalls = function() {
+    return unmockedAjaxCalls;
+  };
+})(jQuery);

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 3 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/modernizr-2.6.2.min.js


+ 2495 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/qunit.js

@@ -0,0 +1,2495 @@
+/*!
+ * QUnit 1.15.0
+ * http://qunitjs.com/
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2014-08-08T16:00Z
+ */
+
+(function( window ) {
+
+var QUnit,
+  config,
+  onErrorFnPrev,
+  fileName = ( sourceFromStacktrace( 0 ) || "" ).replace( /(:\d+)+\)?/, "" ).replace( /.+\//, "" ),
+  toString = Object.prototype.toString,
+  hasOwn = Object.prototype.hasOwnProperty,
+  // Keep a local reference to Date (GH-283)
+  Date = window.Date,
+  now = Date.now || function() {
+    return new Date().getTime();
+  },
+  setTimeout = window.setTimeout,
+  clearTimeout = window.clearTimeout,
+  defined = {
+    document: typeof window.document !== "undefined",
+    setTimeout: typeof window.setTimeout !== "undefined",
+    sessionStorage: (function() {
+      var x = "qunit-test-string";
+      try {
+        sessionStorage.setItem( x, x );
+        sessionStorage.removeItem( x );
+        return true;
+      } catch ( e ) {
+        return false;
+      }
+    }())
+  },
+  /**
+   * Provides a normalized error string, correcting an issue
+   * with IE 7 (and prior) where Error.prototype.toString is
+   * not properly implemented
+   *
+   * Based on http://es5.github.com/#x15.11.4.4
+   *
+   * @param {String|Error} error
+   * @return {String} error message
+   */
+  errorString = function( error ) {
+    var name, message,
+      errorString = error.toString();
+    if ( errorString.substring( 0, 7 ) === "[object" ) {
+      name = error.name ? error.name.toString() : "Error";
+      message = error.message ? error.message.toString() : "";
+      if ( name && message ) {
+        return name + ": " + message;
+      } else if ( name ) {
+        return name;
+      } else if ( message ) {
+        return message;
+      } else {
+        return "Error";
+      }
+    } else {
+      return errorString;
+    }
+  },
+  /**
+   * Makes a clone of an object using only Array or Object as base,
+   * and copies over the own enumerable properties.
+   *
+   * @param {Object} obj
+   * @return {Object} New object with only the own properties (recursively).
+   */
+  objectValues = function( obj ) {
+    var key, val,
+      vals = QUnit.is( "array", obj ) ? [] : {};
+    for ( key in obj ) {
+      if ( hasOwn.call( obj, key ) ) {
+        val = obj[ key ];
+        vals[ key ] = val === Object( val ) ? objectValues( val ) : val;
+      }
+    }
+    return vals;
+  };
+
+// Root QUnit object.
+// `QUnit` initialized at top of scope
+QUnit = {
+
+  // call on start of module test to prepend name to all tests
+  module: function( name, testEnvironment ) {
+    config.currentModule = name;
+    config.currentModuleTestEnvironment = testEnvironment;
+    config.modules[ name ] = true;
+  },
+
+  asyncTest: function( testName, expected, callback ) {
+    if ( arguments.length === 2 ) {
+      callback = expected;
+      expected = null;
+    }
+
+    QUnit.test( testName, expected, callback, true );
+  },
+
+  test: function( testName, expected, callback, async ) {
+    var test;
+
+    if ( arguments.length === 2 ) {
+      callback = expected;
+      expected = null;
+    }
+
+    test = new Test({
+      testName: testName,
+      expected: expected,
+      async: async,
+      callback: callback,
+      module: config.currentModule,
+      moduleTestEnvironment: config.currentModuleTestEnvironment,
+      stack: sourceFromStacktrace( 2 )
+    });
+
+    if ( !validTest( test ) ) {
+      return;
+    }
+
+    test.queue();
+  },
+
+  start: function( count ) {
+    var message;
+
+    // QUnit hasn't been initialized yet.
+    // Note: RequireJS (et al) may delay onLoad
+    if ( config.semaphore === undefined ) {
+      QUnit.begin(function() {
+        // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first
+        setTimeout(function() {
+          QUnit.start( count );
+        });
+      });
+      return;
+    }
+
+    config.semaphore -= count || 1;
+    // don't start until equal number of stop-calls
+    if ( config.semaphore > 0 ) {
+      return;
+    }
+
+    // Set the starting time when the first test is run
+    QUnit.config.started = QUnit.config.started || now();
+    // ignore if start is called more often then stop
+    if ( config.semaphore < 0 ) {
+      config.semaphore = 0;
+
+      message = "Called start() while already started (QUnit.config.semaphore was 0 already)";
+
+      if ( config.current ) {
+        QUnit.pushFailure( message, sourceFromStacktrace( 2 ) );
+      } else {
+        throw new Error( message );
+      }
+
+      return;
+    }
+    // A slight delay, to avoid any current callbacks
+    if ( defined.setTimeout ) {
+      setTimeout(function() {
+        if ( config.semaphore > 0 ) {
+          return;
+        }
+        if ( config.timeout ) {
+          clearTimeout( config.timeout );
+        }
+
+        config.blocking = false;
+        process( true );
+      }, 13 );
+    } else {
+      config.blocking = false;
+      process( true );
+    }
+  },
+
+  stop: function( count ) {
+    config.semaphore += count || 1;
+    config.blocking = true;
+
+    if ( config.testTimeout && defined.setTimeout ) {
+      clearTimeout( config.timeout );
+      config.timeout = setTimeout(function() {
+        QUnit.ok( false, "Test timed out" );
+        config.semaphore = 1;
+        QUnit.start();
+      }, config.testTimeout );
+    }
+  }
+};
+
+// We use the prototype to distinguish between properties that should
+// be exposed as globals (and in exports) and those that shouldn't
+(function() {
+  function F() {}
+  F.prototype = QUnit;
+  QUnit = new F();
+
+  // Make F QUnit's constructor so that we can add to the prototype later
+  QUnit.constructor = F;
+}());
+
+/**
+ * Config object: Maintain internal state
+ * Later exposed as QUnit.config
+ * `config` initialized at top of scope
+ */
+config = {
+  // The queue of tests to run
+  queue: [],
+
+  // block until document ready
+  blocking: true,
+
+  // when enabled, show only failing tests
+  // gets persisted through sessionStorage and can be changed in UI via checkbox
+  hidepassed: false,
+
+  // by default, run previously failed tests first
+  // very useful in combination with "Hide passed tests" checked
+  reorder: true,
+
+  // by default, modify document.title when suite is done
+  altertitle: true,
+
+  // by default, scroll to top of the page when suite is done
+  scrolltop: true,
+
+  // when enabled, all tests must call expect()
+  requireExpects: false,
+
+  // add checkboxes that are persisted in the query-string
+  // when enabled, the id is set to `true` as a `QUnit.config` property
+  urlConfig: [
+    {
+      id: "noglobals",
+      label: "Check for Globals",
+      tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."
+    },
+    {
+      id: "notrycatch",
+      label: "No try-catch",
+      tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
+    }
+  ],
+
+  // Set of all modules.
+  modules: {},
+
+  callbacks: {}
+};
+
+// Initialize more QUnit.config and QUnit.urlParams
+(function() {
+  var i, current,
+    location = window.location || { search: "", protocol: "file:" },
+    params = location.search.slice( 1 ).split( "&" ),
+    length = params.length,
+    urlParams = {};
+
+  if ( params[ 0 ] ) {
+    for ( i = 0; i < length; i++ ) {
+      current = params[ i ].split( "=" );
+      current[ 0 ] = decodeURIComponent( current[ 0 ] );
+
+      // allow just a key to turn on a flag, e.g., test.html?noglobals
+      current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
+      if ( urlParams[ current[ 0 ] ] ) {
+        urlParams[ current[ 0 ] ] = [].concat( urlParams[ current[ 0 ] ], current[ 1 ] );
+      } else {
+        urlParams[ current[ 0 ] ] = current[ 1 ];
+      }
+    }
+  }
+
+  QUnit.urlParams = urlParams;
+
+  // String search anywhere in moduleName+testName
+  config.filter = urlParams.filter;
+
+  // Exact match of the module name
+  config.module = urlParams.module;
+
+  config.testNumber = [];
+  if ( urlParams.testNumber ) {
+
+    // Ensure that urlParams.testNumber is an array
+    urlParams.testNumber = [].concat( urlParams.testNumber );
+    for ( i = 0; i < urlParams.testNumber.length; i++ ) {
+      current = urlParams.testNumber[ i ];
+      config.testNumber.push( parseInt( current, 10 ) );
+    }
+  }
+
+  // Figure out if we're running the tests from a server or not
+  QUnit.isLocal = location.protocol === "file:";
+}());
+
+extend( QUnit, {
+
+  config: config,
+
+  // Safe object type checking
+  is: function( type, obj ) {
+    return QUnit.objectType( obj ) === type;
+  },
+
+  objectType: function( obj ) {
+    if ( typeof obj === "undefined" ) {
+      return "undefined";
+    }
+
+    // Consider: typeof null === object
+    if ( obj === null ) {
+      return "null";
+    }
+
+    var match = toString.call( obj ).match( /^\[object\s(.*)\]$/ ),
+      type = match && match[ 1 ] || "";
+
+    switch ( type ) {
+      case "Number":
+        if ( isNaN( obj ) ) {
+          return "nan";
+        }
+        return "number";
+      case "String":
+      case "Boolean":
+      case "Array":
+      case "Date":
+      case "RegExp":
+      case "Function":
+        return type.toLowerCase();
+    }
+    if ( typeof obj === "object" ) {
+      return "object";
+    }
+    return undefined;
+  },
+
+  url: function( params ) {
+    params = extend( extend( {}, QUnit.urlParams ), params );
+    var key,
+      querystring = "?";
+
+    for ( key in params ) {
+      if ( hasOwn.call( params, key ) ) {
+        querystring += encodeURIComponent( key ) + "=" +
+          encodeURIComponent( params[ key ] ) + "&";
+      }
+    }
+    return window.location.protocol + "//" + window.location.host +
+      window.location.pathname + querystring.slice( 0, -1 );
+  },
+
+  extend: extend
+});
+
+/**
+ * @deprecated: Created for backwards compatibility with test runner that set the hook function
+ * into QUnit.{hook}, instead of invoking it and passing the hook function.
+ * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here.
+ * Doing this allows us to tell if the following methods have been overwritten on the actual
+ * QUnit object.
+ */
+extend( QUnit.constructor.prototype, {
+
+  // Logging callbacks; all receive a single argument with the listed properties
+  // run test/logs.html for any related changes
+  begin: registerLoggingCallback( "begin" ),
+
+  // done: { failed, passed, total, runtime }
+  done: registerLoggingCallback( "done" ),
+
+  // log: { result, actual, expected, message }
+  log: registerLoggingCallback( "log" ),
+
+  // testStart: { name }
+  testStart: registerLoggingCallback( "testStart" ),
+
+  // testDone: { name, failed, passed, total, runtime }
+  testDone: registerLoggingCallback( "testDone" ),
+
+  // moduleStart: { name }
+  moduleStart: registerLoggingCallback( "moduleStart" ),
+
+  // moduleDone: { name, failed, passed, total }
+  moduleDone: registerLoggingCallback( "moduleDone" )
+});
+
+QUnit.load = function() {
+  runLoggingCallbacks( "begin", {
+    totalTests: Test.count
+  });
+
+  // Initialize the configuration options
+  extend( config, {
+    stats: { all: 0, bad: 0 },
+    moduleStats: { all: 0, bad: 0 },
+    started: 0,
+    updateRate: 1000,
+    autostart: true,
+    filter: "",
+    semaphore: 1
+  }, true );
+
+  config.blocking = false;
+
+  if ( config.autostart ) {
+    QUnit.start();
+  }
+};
+
+// `onErrorFnPrev` initialized at top of scope
+// Preserve other handlers
+onErrorFnPrev = window.onerror;
+
+// Cover uncaught exceptions
+// Returning true will suppress the default browser handler,
+// returning false will let it run.
+window.onerror = function( error, filePath, linerNr ) {
+  var ret = false;
+  if ( onErrorFnPrev ) {
+    ret = onErrorFnPrev( error, filePath, linerNr );
+  }
+
+  // Treat return value as window.onerror itself does,
+  // Only do our handling if not suppressed.
+  if ( ret !== true ) {
+    if ( QUnit.config.current ) {
+      if ( QUnit.config.current.ignoreGlobalErrors ) {
+        return true;
+      }
+      QUnit.pushFailure( error, filePath + ":" + linerNr );
+    } else {
+      QUnit.test( "global failure", extend(function() {
+        QUnit.pushFailure( error, filePath + ":" + linerNr );
+      }, { validTest: validTest } ) );
+    }
+    return false;
+  }
+
+  return ret;
+};
+
+function done() {
+  config.autorun = true;
+
+  // Log the last module results
+  if ( config.previousModule ) {
+    runLoggingCallbacks( "moduleDone", {
+      name: config.previousModule,
+      failed: config.moduleStats.bad,
+      passed: config.moduleStats.all - config.moduleStats.bad,
+      total: config.moduleStats.all
+    });
+  }
+  delete config.previousModule;
+
+  var runtime = now() - config.started,
+    passed = config.stats.all - config.stats.bad;
+
+  runLoggingCallbacks( "done", {
+    failed: config.stats.bad,
+    passed: passed,
+    total: config.stats.all,
+    runtime: runtime
+  });
+}
+
+/** @return Boolean: true if this test should be ran */
+function validTest( test ) {
+  var include,
+    filter = config.filter && config.filter.toLowerCase(),
+    module = config.module && config.module.toLowerCase(),
+    fullName = ( test.module + ": " + test.testName ).toLowerCase();
+
+  // Internally-generated tests are always valid
+  if ( test.callback && test.callback.validTest === validTest ) {
+    delete test.callback.validTest;
+    return true;
+  }
+
+  if ( config.testNumber.length > 0 ) {
+    if ( inArray( test.testNumber, config.testNumber ) < 0 ) {
+      return false;
+    }
+  }
+
+  if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) {
+    return false;
+  }
+
+  if ( !filter ) {
+    return true;
+  }
+
+  include = filter.charAt( 0 ) !== "!";
+  if ( !include ) {
+    filter = filter.slice( 1 );
+  }
+
+  // If the filter matches, we need to honour include
+  if ( fullName.indexOf( filter ) !== -1 ) {
+    return include;
+  }
+
+  // Otherwise, do the opposite
+  return !include;
+}
+
+// Doesn't support IE6 to IE9
+// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
+function extractStacktrace( e, offset ) {
+  offset = offset === undefined ? 4 : offset;
+
+  var stack, include, i;
+
+  if ( e.stacktrace ) {
+
+    // Opera 12.x
+    return e.stacktrace.split( "\n" )[ offset + 3 ];
+  } else if ( e.stack ) {
+
+    // Firefox, Chrome, Safari 6+, IE10+, PhantomJS and Node
+    stack = e.stack.split( "\n" );
+    if ( /^error$/i.test( stack[ 0 ] ) ) {
+      stack.shift();
+    }
+    if ( fileName ) {
+      include = [];
+      for ( i = offset; i < stack.length; i++ ) {
+        if ( stack[ i ].indexOf( fileName ) !== -1 ) {
+          break;
+        }
+        include.push( stack[ i ] );
+      }
+      if ( include.length ) {
+        return include.join( "\n" );
+      }
+    }
+    return stack[ offset ];
+  } else if ( e.sourceURL ) {
+
+    // Safari < 6
+    // exclude useless self-reference for generated Error objects
+    if ( /qunit.js$/.test( e.sourceURL ) ) {
+      return;
+    }
+
+    // for actual exceptions, this is useful
+    return e.sourceURL + ":" + e.line;
+  }
+}
+function sourceFromStacktrace( offset ) {
+  try {
+    throw new Error();
+  } catch ( e ) {
+    return extractStacktrace( e, offset );
+  }
+}
+
+function synchronize( callback, last ) {
+  config.queue.push( callback );
+
+  if ( config.autorun && !config.blocking ) {
+    process( last );
+  }
+}
+
+function process( last ) {
+  function next() {
+    process( last );
+  }
+  var start = now();
+  config.depth = config.depth ? config.depth + 1 : 1;
+
+  while ( config.queue.length && !config.blocking ) {
+    if ( !defined.setTimeout || config.updateRate <= 0 || ( ( now() - start ) < config.updateRate ) ) {
+      config.queue.shift()();
+    } else {
+      setTimeout( next, 13 );
+      break;
+    }
+  }
+  config.depth--;
+  if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) {
+    done();
+  }
+}
+
+function saveGlobal() {
+  config.pollution = [];
+
+  if ( config.noglobals ) {
+    for ( var key in window ) {
+      if ( hasOwn.call( window, key ) ) {
+        // in Opera sometimes DOM element ids show up here, ignore them
+        if ( /^qunit-test-output/.test( key ) ) {
+          continue;
+        }
+        config.pollution.push( key );
+      }
+    }
+  }
+}
+
+function checkPollution() {
+  var newGlobals,
+    deletedGlobals,
+    old = config.pollution;
+
+  saveGlobal();
+
+  newGlobals = diff( config.pollution, old );
+  if ( newGlobals.length > 0 ) {
+    QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join( ", " ) );
+  }
+
+  deletedGlobals = diff( old, config.pollution );
+  if ( deletedGlobals.length > 0 ) {
+    QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join( ", " ) );
+  }
+}
+
+// returns a new Array with the elements that are in a but not in b
+function diff( a, b ) {
+  var i, j,
+    result = a.slice();
+
+  for ( i = 0; i < result.length; i++ ) {
+    for ( j = 0; j < b.length; j++ ) {
+      if ( result[ i ] === b[ j ] ) {
+        result.splice( i, 1 );
+        i--;
+        break;
+      }
+    }
+  }
+  return result;
+}
+
+function extend( a, b, undefOnly ) {
+  for ( var prop in b ) {
+    if ( hasOwn.call( b, prop ) ) {
+
+      // Avoid "Member not found" error in IE8 caused by messing with window.constructor
+      if ( !( prop === "constructor" && a === window ) ) {
+        if ( b[ prop ] === undefined ) {
+          delete a[ prop ];
+        } else if ( !( undefOnly && typeof a[ prop ] !== "undefined" ) ) {
+          a[ prop ] = b[ prop ];
+        }
+      }
+    }
+  }
+
+  return a;
+}
+
+function registerLoggingCallback( key ) {
+
+  // Initialize key collection of logging callback
+  if ( QUnit.objectType( config.callbacks[ key ] ) === "undefined" ) {
+    config.callbacks[ key ] = [];
+  }
+
+  return function( callback ) {
+    config.callbacks[ key ].push( callback );
+  };
+}
+
+function runLoggingCallbacks( key, args ) {
+  var i, l, callbacks;
+
+  callbacks = config.callbacks[ key ];
+  for ( i = 0, l = callbacks.length; i < l; i++ ) {
+    callbacks[ i ]( args );
+  }
+}
+
+// from jquery.js
+function inArray( elem, array ) {
+  if ( array.indexOf ) {
+    return array.indexOf( elem );
+  }
+
+  for ( var i = 0, length = array.length; i < length; i++ ) {
+    if ( array[ i ] === elem ) {
+      return i;
+    }
+  }
+
+  return -1;
+}
+
+function Test( settings ) {
+  extend( this, settings );
+  this.assert = new Assert( this );
+  this.assertions = [];
+  this.testNumber = ++Test.count;
+}
+
+Test.count = 0;
+
+Test.prototype = {
+  setup: function() {
+    if (
+
+      // Emit moduleStart when we're switching from one module to another
+      this.module !== config.previousModule ||
+
+        // They could be equal (both undefined) but if the previousModule property doesn't
+        // yet exist it means this is the first test in a suite that isn't wrapped in a
+        // module, in which case we'll just emit a moduleStart event for 'undefined'.
+        // Without this, reporters can get testStart before moduleStart  which is a problem.
+        !hasOwn.call( config, "previousModule" )
+    ) {
+      if ( hasOwn.call( config, "previousModule" ) ) {
+        runLoggingCallbacks( "moduleDone", {
+          name: config.previousModule,
+          failed: config.moduleStats.bad,
+          passed: config.moduleStats.all - config.moduleStats.bad,
+          total: config.moduleStats.all
+        });
+      }
+      config.previousModule = this.module;
+      config.moduleStats = { all: 0, bad: 0 };
+      runLoggingCallbacks( "moduleStart", {
+        name: this.module
+      });
+    }
+
+    config.current = this;
+
+    this.testEnvironment = extend({
+      setup: function() {},
+      teardown: function() {}
+    }, this.moduleTestEnvironment );
+
+    this.started = now();
+    runLoggingCallbacks( "testStart", {
+      name: this.testName,
+      module: this.module,
+      testNumber: this.testNumber
+    });
+
+    if ( !config.pollution ) {
+      saveGlobal();
+    }
+    if ( config.notrycatch ) {
+      this.testEnvironment.setup.call( this.testEnvironment, this.assert );
+      return;
+    }
+    try {
+      this.testEnvironment.setup.call( this.testEnvironment, this.assert );
+    } catch ( e ) {
+      this.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 0 ) );
+    }
+  },
+  run: function() {
+    config.current = this;
+
+    if ( this.async ) {
+      QUnit.stop();
+    }
+
+    this.callbackStarted = now();
+
+    if ( config.notrycatch ) {
+      this.callback.call( this.testEnvironment, this.assert );
+      this.callbackRuntime = now() - this.callbackStarted;
+      return;
+    }
+
+    try {
+      this.callback.call( this.testEnvironment, this.assert );
+      this.callbackRuntime = now() - this.callbackStarted;
+    } catch ( e ) {
+      this.callbackRuntime = now() - this.callbackStarted;
+
+      this.pushFailure( "Died on test #" + ( this.assertions.length + 1 ) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) );
+
+      // else next test will carry the responsibility
+      saveGlobal();
+
+      // Restart the tests if they're blocking
+      if ( config.blocking ) {
+        QUnit.start();
+      }
+    }
+  },
+  teardown: function() {
+    config.current = this;
+    if ( config.notrycatch ) {
+      if ( typeof this.callbackRuntime === "undefined" ) {
+        this.callbackRuntime = now() - this.callbackStarted;
+      }
+      this.testEnvironment.teardown.call( this.testEnvironment, this.assert );
+      return;
+    } else {
+      try {
+        this.testEnvironment.teardown.call( this.testEnvironment, this.assert );
+      } catch ( e ) {
+        this.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 0 ) );
+      }
+    }
+    checkPollution();
+  },
+  finish: function() {
+    config.current = this;
+    if ( config.requireExpects && this.expected === null ) {
+      this.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack );
+    } else if ( this.expected !== null && this.expected !== this.assertions.length ) {
+      this.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack );
+    } else if ( this.expected === null && !this.assertions.length ) {
+      this.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack );
+    }
+
+    var i,
+      bad = 0;
+
+    this.runtime = now() - this.started;
+    config.stats.all += this.assertions.length;
+    config.moduleStats.all += this.assertions.length;
+
+    for ( i = 0; i < this.assertions.length; i++ ) {
+      if ( !this.assertions[ i ].result ) {
+        bad++;
+        config.stats.bad++;
+        config.moduleStats.bad++;
+      }
+    }
+
+    runLoggingCallbacks( "testDone", {
+      name: this.testName,
+      module: this.module,
+      failed: bad,
+      passed: this.assertions.length - bad,
+      total: this.assertions.length,
+      runtime: this.runtime,
+
+      // HTML Reporter use
+      assertions: this.assertions,
+      testNumber: this.testNumber,
+
+      // DEPRECATED: this property will be removed in 2.0.0, use runtime instead
+      duration: this.runtime
+    });
+
+    config.current = undefined;
+  },
+
+  queue: function() {
+    var bad,
+      test = this;
+
+    function run() {
+      // each of these can by async
+      synchronize(function() {
+        test.setup();
+      });
+      synchronize(function() {
+        test.run();
+      });
+      synchronize(function() {
+        test.teardown();
+      });
+      synchronize(function() {
+        test.finish();
+      });
+    }
+
+    // `bad` initialized at top of scope
+    // defer when previous test run passed, if storage is available
+    bad = QUnit.config.reorder && defined.sessionStorage &&
+        +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName );
+
+    if ( bad ) {
+      run();
+    } else {
+      synchronize( run, true );
+    }
+  },
+
+  push: function( result, actual, expected, message ) {
+    var source,
+      details = {
+        module: this.module,
+        name: this.testName,
+        result: result,
+        message: message,
+        actual: actual,
+        expected: expected,
+        testNumber: this.testNumber
+      };
+
+    if ( !result ) {
+      source = sourceFromStacktrace();
+
+      if ( source ) {
+        details.source = source;
+      }
+    }
+
+    runLoggingCallbacks( "log", details );
+
+    this.assertions.push({
+      result: !!result,
+      message: message
+    });
+  },
+
+  pushFailure: function( message, source, actual ) {
+    if ( !this instanceof Test ) {
+      throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace( 2 ) );
+    }
+
+    var details = {
+        module: this.module,
+        name: this.testName,
+        result: false,
+        message: message || "error",
+        actual: actual || null,
+        testNumber: this.testNumber
+      };
+
+    if ( source ) {
+      details.source = source;
+    }
+
+    runLoggingCallbacks( "log", details );
+
+    this.assertions.push({
+      result: false,
+      message: message
+    });
+  }
+};
+
+QUnit.pushFailure = function() {
+  if ( !QUnit.config.current ) {
+    throw new Error( "pushFailure() assertion outside test context, in " + sourceFromStacktrace( 2 ) );
+  }
+
+  // Gets current test obj
+  var currentTest = QUnit.config.current.assert.test;
+
+  return currentTest.pushFailure.apply( currentTest, arguments );
+};
+
+function Assert( testContext ) {
+  this.test = testContext;
+}
+
+// Assert helpers
+QUnit.assert = Assert.prototype = {
+
+  // Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through.
+  expect: function( asserts ) {
+    if ( arguments.length === 1 ) {
+      this.test.expected = asserts;
+    } else {
+      return this.test.expected;
+    }
+  },
+
+  // Exports test.push() to the user API
+  push: function() {
+    var assert = this;
+
+    // Backwards compatibility fix.
+    // Allows the direct use of global exported assertions and QUnit.assert.*
+    // Although, it's use is not recommended as it can leak assertions
+    // to other tests from async tests, because we only get a reference to the current test,
+    // not exactly the test where assertion were intended to be called.
+    if ( !QUnit.config.current ) {
+      throw new Error( "assertion outside test context, in " + sourceFromStacktrace( 2 ) );
+    }
+    if ( !( assert instanceof Assert ) ) {
+      assert = QUnit.config.current.assert;
+    }
+    return assert.test.push.apply( assert.test, arguments );
+  },
+
+  /**
+   * Asserts rough true-ish result.
+   * @name ok
+   * @function
+   * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
+   */
+  ok: function( result, message ) {
+    message = message || ( result ? "okay" : "failed, expected argument to be truthy, was: " +
+      QUnit.dump.parse( result ) );
+    if ( !!result ) {
+      this.push( true, result, true, message );
+    } else {
+      this.test.pushFailure( message, null, result );
+    }
+  },
+
+  /**
+   * Assert that the first two arguments are equal, with an optional message.
+   * Prints out both actual and expected values.
+   * @name equal
+   * @function
+   * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
+   */
+  equal: function( actual, expected, message ) {
+    /*jshint eqeqeq:false */
+    this.push( expected == actual, actual, expected, message );
+  },
+
+  /**
+   * @name notEqual
+   * @function
+   */
+  notEqual: function( actual, expected, message ) {
+    /*jshint eqeqeq:false */
+    this.push( expected != actual, actual, expected, message );
+  },
+
+  /**
+   * @name propEqual
+   * @function
+   */
+  propEqual: function( actual, expected, message ) {
+    actual = objectValues( actual );
+    expected = objectValues( expected );
+    this.push( QUnit.equiv( actual, expected ), actual, expected, message );
+  },
+
+  /**
+   * @name notPropEqual
+   * @function
+   */
+  notPropEqual: function( actual, expected, message ) {
+    actual = objectValues( actual );
+    expected = objectValues( expected );
+    this.push( !QUnit.equiv( actual, expected ), actual, expected, message );
+  },
+
+  /**
+   * @name deepEqual
+   * @function
+   */
+  deepEqual: function( actual, expected, message ) {
+    this.push( QUnit.equiv( actual, expected ), actual, expected, message );
+  },
+
+  /**
+   * @name notDeepEqual
+   * @function
+   */
+  notDeepEqual: function( actual, expected, message ) {
+    this.push( !QUnit.equiv( actual, expected ), actual, expected, message );
+  },
+
+  /**
+   * @name strictEqual
+   * @function
+   */
+  strictEqual: function( actual, expected, message ) {
+    this.push( expected === actual, actual, expected, message );
+  },
+
+  /**
+   * @name notStrictEqual
+   * @function
+   */
+  notStrictEqual: function( actual, expected, message ) {
+    this.push( expected !== actual, actual, expected, message );
+  },
+
+  "throws": function( block, expected, message ) {
+    var actual, expectedType,
+      expectedOutput = expected,
+      ok = false;
+
+    // 'expected' is optional unless doing string comparison
+    if ( message == null && typeof expected === "string" ) {
+      message = expected;
+      expected = null;
+    }
+
+    this.test.ignoreGlobalErrors = true;
+    try {
+      block.call( this.test.testEnvironment );
+    } catch (e) {
+      actual = e;
+    }
+    this.test.ignoreGlobalErrors = false;
+
+    if ( actual ) {
+      expectedType = QUnit.objectType( expected );
+
+      // we don't want to validate thrown error
+      if ( !expected ) {
+        ok = true;
+        expectedOutput = null;
+
+      // expected is a regexp
+      } else if ( expectedType === "regexp" ) {
+        ok = expected.test( errorString( actual ) );
+
+      // expected is a string
+      } else if ( expectedType === "string" ) {
+        ok = expected === errorString( actual );
+
+      // expected is a constructor, maybe an Error constructor
+      } else if ( expectedType === "function" && actual instanceof expected ) {
+        ok = true;
+
+      // expected is an Error object
+      } else if ( expectedType === "object" ) {
+        ok = actual instanceof expected.constructor &&
+          actual.name === expected.name &&
+          actual.message === expected.message;
+
+      // expected is a validation function which returns true if validation passed
+      } else if ( expectedType === "function" && expected.call( {}, actual ) === true ) {
+        expectedOutput = null;
+        ok = true;
+      }
+
+      this.push( ok, actual, expectedOutput, message );
+    } else {
+      this.test.pushFailure( message, null, "No exception was thrown." );
+    }
+  }
+};
+
+// Test for equality any JavaScript type.
+// Author: Philippe Rathé <prathe@gmail.com>
+QUnit.equiv = (function() {
+
+  // Call the o related callback with the given arguments.
+  function bindCallbacks( o, callbacks, args ) {
+    var prop = QUnit.objectType( o );
+    if ( prop ) {
+      if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
+        return callbacks[ prop ].apply( callbacks, args );
+      } else {
+        return callbacks[ prop ]; // or undefined
+      }
+    }
+  }
+
+  // the real equiv function
+  var innerEquiv,
+
+    // stack to decide between skip/abort functions
+    callers = [],
+
+    // stack to avoiding loops from circular referencing
+    parents = [],
+    parentsB = [],
+
+    getProto = Object.getPrototypeOf || function( obj ) {
+      /* jshint camelcase: false, proto: true */
+      return obj.__proto__;
+    },
+    callbacks = (function() {
+
+      // for string, boolean, number and null
+      function useStrictEquality( b, a ) {
+
+        /*jshint eqeqeq:false */
+        if ( b instanceof a.constructor || a instanceof b.constructor ) {
+
+          // to catch short annotation VS 'new' annotation of a
+          // declaration
+          // e.g. var i = 1;
+          // var j = new Number(1);
+          return a == b;
+        } else {
+          return a === b;
+        }
+      }
+
+      return {
+        "string": useStrictEquality,
+        "boolean": useStrictEquality,
+        "number": useStrictEquality,
+        "null": useStrictEquality,
+        "undefined": useStrictEquality,
+
+        "nan": function( b ) {
+          return isNaN( b );
+        },
+
+        "date": function( b, a ) {
+          return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf();
+        },
+
+        "regexp": function( b, a ) {
+          return QUnit.objectType( b ) === "regexp" &&
+
+            // the regex itself
+            a.source === b.source &&
+
+            // and its modifiers
+            a.global === b.global &&
+
+            // (gmi) ...
+            a.ignoreCase === b.ignoreCase &&
+            a.multiline === b.multiline &&
+            a.sticky === b.sticky;
+        },
+
+        // - skip when the property is a method of an instance (OOP)
+        // - abort otherwise,
+        // initial === would have catch identical references anyway
+        "function": function() {
+          var caller = callers[ callers.length - 1 ];
+          return caller !== Object && typeof caller !== "undefined";
+        },
+
+        "array": function( b, a ) {
+          var i, j, len, loop, aCircular, bCircular;
+
+          // b could be an object literal here
+          if ( QUnit.objectType( b ) !== "array" ) {
+            return false;
+          }
+
+          len = a.length;
+          if ( len !== b.length ) {
+            // safe and faster
+            return false;
+          }
+
+          // track reference to avoid circular references
+          parents.push( a );
+          parentsB.push( b );
+          for ( i = 0; i < len; i++ ) {
+            loop = false;
+            for ( j = 0; j < parents.length; j++ ) {
+              aCircular = parents[ j ] === a[ i ];
+              bCircular = parentsB[ j ] === b[ i ];
+              if ( aCircular || bCircular ) {
+                if ( a[ i ] === b[ i ] || aCircular && bCircular ) {
+                  loop = true;
+                } else {
+                  parents.pop();
+                  parentsB.pop();
+                  return false;
+                }
+              }
+            }
+            if ( !loop && !innerEquiv( a[ i ], b[ i ] ) ) {
+              parents.pop();
+              parentsB.pop();
+              return false;
+            }
+          }
+          parents.pop();
+          parentsB.pop();
+          return true;
+        },
+
+        "object": function( b, a ) {
+
+          /*jshint forin:false */
+          var i, j, loop, aCircular, bCircular,
+            // Default to true
+            eq = true,
+            aProperties = [],
+            bProperties = [];
+
+          // comparing constructors is more strict than using
+          // instanceof
+          if ( a.constructor !== b.constructor ) {
+
+            // Allow objects with no prototype to be equivalent to
+            // objects with Object as their constructor.
+            if ( !( ( getProto( a ) === null && getProto( b ) === Object.prototype ) ||
+              ( getProto( b ) === null && getProto( a ) === Object.prototype ) ) ) {
+              return false;
+            }
+          }
+
+          // stack constructor before traversing properties
+          callers.push( a.constructor );
+
+          // track reference to avoid circular references
+          parents.push( a );
+          parentsB.push( b );
+
+          // be strict: don't ensure hasOwnProperty and go deep
+          for ( i in a ) {
+            loop = false;
+            for ( j = 0; j < parents.length; j++ ) {
+              aCircular = parents[ j ] === a[ i ];
+              bCircular = parentsB[ j ] === b[ i ];
+              if ( aCircular || bCircular ) {
+                if ( a[ i ] === b[ i ] || aCircular && bCircular ) {
+                  loop = true;
+                } else {
+                  eq = false;
+                  break;
+                }
+              }
+            }
+            aProperties.push( i );
+            if ( !loop && !innerEquiv( a[ i ], b[ i ] ) ) {
+              eq = false;
+              break;
+            }
+          }
+
+          parents.pop();
+          parentsB.pop();
+          callers.pop(); // unstack, we are done
+
+          for ( i in b ) {
+            bProperties.push( i ); // collect b's properties
+          }
+
+          // Ensures identical properties name
+          return eq && innerEquiv( aProperties.sort(), bProperties.sort() );
+        }
+      };
+    }());
+
+  innerEquiv = function() { // can take multiple arguments
+    var args = [].slice.apply( arguments );
+    if ( args.length < 2 ) {
+      return true; // end transition
+    }
+
+    return ( (function( a, b ) {
+      if ( a === b ) {
+        return true; // catch the most you can
+      } else if ( a === null || b === null || typeof a === "undefined" ||
+          typeof b === "undefined" ||
+          QUnit.objectType( a ) !== QUnit.objectType( b ) ) {
+
+        // don't lose time with error prone cases
+        return false;
+      } else {
+        return bindCallbacks( a, callbacks, [ b, a ] );
+      }
+
+      // apply transition with (1..n) arguments
+    }( args[ 0 ], args[ 1 ] ) ) && innerEquiv.apply( this, args.splice( 1, args.length - 1 ) ) );
+  };
+
+  return innerEquiv;
+}());
+
+// Based on jsDump by Ariel Flesler
+// http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html
+QUnit.dump = (function() {
+  function quote( str ) {
+    return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\"";
+  }
+  function literal( o ) {
+    return o + "";
+  }
+  function join( pre, arr, post ) {
+    var s = dump.separator(),
+      base = dump.indent(),
+      inner = dump.indent( 1 );
+    if ( arr.join ) {
+      arr = arr.join( "," + s + inner );
+    }
+    if ( !arr ) {
+      return pre + post;
+    }
+    return [ pre, inner + arr, base + post ].join( s );
+  }
+  function array( arr, stack ) {
+    var i = arr.length,
+      ret = new Array( i );
+    this.up();
+    while ( i-- ) {
+      ret[ i ] = this.parse( arr[ i ], undefined, stack );
+    }
+    this.down();
+    return join( "[", ret, "]" );
+  }
+
+  var reName = /^function (\w+)/,
+    dump = {
+      // type is used mostly internally, you can fix a (custom)type in advance
+      parse: function( obj, type, stack ) {
+        stack = stack || [];
+        var inStack, res,
+          parser = this.parsers[ type || this.typeOf( obj ) ];
+
+        type = typeof parser;
+        inStack = inArray( obj, stack );
+
+        if ( inStack !== -1 ) {
+          return "recursion(" + ( inStack - stack.length ) + ")";
+        }
+        if ( type === "function" ) {
+          stack.push( obj );
+          res = parser.call( this, obj, stack );
+          stack.pop();
+          return res;
+        }
+        return ( type === "string" ) ? parser : this.parsers.error;
+      },
+      typeOf: function( obj ) {
+        var type;
+        if ( obj === null ) {
+          type = "null";
+        } else if ( typeof obj === "undefined" ) {
+          type = "undefined";
+        } else if ( QUnit.is( "regexp", obj ) ) {
+          type = "regexp";
+        } else if ( QUnit.is( "date", obj ) ) {
+          type = "date";
+        } else if ( QUnit.is( "function", obj ) ) {
+          type = "function";
+        } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) {
+          type = "window";
+        } else if ( obj.nodeType === 9 ) {
+          type = "document";
+        } else if ( obj.nodeType ) {
+          type = "node";
+        } else if (
+
+          // native arrays
+          toString.call( obj ) === "[object Array]" ||
+
+          // NodeList objects
+          ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item( 0 ) === obj[ 0 ] : ( obj.item( 0 ) === null && typeof obj[ 0 ] === "undefined" ) ) )
+        ) {
+          type = "array";
+        } else if ( obj.constructor === Error.prototype.constructor ) {
+          type = "error";
+        } else {
+          type = typeof obj;
+        }
+        return type;
+      },
+      separator: function() {
+        return this.multiline ? this.HTML ? "<br />" : "\n" : this.HTML ? "&nbsp;" : " ";
+      },
+      // extra can be a number, shortcut for increasing-calling-decreasing
+      indent: function( extra ) {
+        if ( !this.multiline ) {
+          return "";
+        }
+        var chr = this.indentChar;
+        if ( this.HTML ) {
+          chr = chr.replace( /\t/g, "   " ).replace( / /g, "&nbsp;" );
+        }
+        return new Array( this.depth + ( extra || 0 ) ).join( chr );
+      },
+      up: function( a ) {
+        this.depth += a || 1;
+      },
+      down: function( a ) {
+        this.depth -= a || 1;
+      },
+      setParser: function( name, parser ) {
+        this.parsers[ name ] = parser;
+      },
+      // The next 3 are exposed so you can use them
+      quote: quote,
+      literal: literal,
+      join: join,
+      //
+      depth: 1,
+      // This is the list of parsers, to modify them, use dump.setParser
+      parsers: {
+        window: "[Window]",
+        document: "[Document]",
+        error: function( error ) {
+          return "Error(\"" + error.message + "\")";
+        },
+        unknown: "[Unknown]",
+        "null": "null",
+        "undefined": "undefined",
+        "function": function( fn ) {
+          var ret = "function",
+            // functions never have name in IE
+            name = "name" in fn ? fn.name : ( reName.exec( fn ) || [] )[ 1 ];
+
+          if ( name ) {
+            ret += " " + name;
+          }
+          ret += "( ";
+
+          ret = [ ret, dump.parse( fn, "functionArgs" ), "){" ].join( "" );
+          return join( ret, dump.parse( fn, "functionCode" ), "}" );
+        },
+        array: array,
+        nodelist: array,
+        "arguments": array,
+        object: function( map, stack ) {
+          /*jshint forin:false */
+          var ret = [], keys, key, val, i, nonEnumerableProperties;
+          dump.up();
+          keys = [];
+          for ( key in map ) {
+            keys.push( key );
+          }
+
+          // Some properties are not always enumerable on Error objects.
+          nonEnumerableProperties = [ "message", "name" ];
+          for ( i in nonEnumerableProperties ) {
+            key = nonEnumerableProperties[ i ];
+            if ( key in map && !( key in keys ) ) {
+              keys.push( key );
+            }
+          }
+          keys.sort();
+          for ( i = 0; i < keys.length; i++ ) {
+            key = keys[ i ];
+            val = map[ key ];
+            ret.push( dump.parse( key, "key" ) + ": " + dump.parse( val, undefined, stack ) );
+          }
+          dump.down();
+          return join( "{", ret, "}" );
+        },
+        node: function( node ) {
+          var len, i, val,
+            open = dump.HTML ? "&lt;" : "<",
+            close = dump.HTML ? "&gt;" : ">",
+            tag = node.nodeName.toLowerCase(),
+            ret = open + tag,
+            attrs = node.attributes;
+
+          if ( attrs ) {
+            for ( i = 0, len = attrs.length; i < len; i++ ) {
+              val = attrs[ i ].nodeValue;
+
+              // IE6 includes all attributes in .attributes, even ones not explicitly set.
+              // Those have values like undefined, null, 0, false, "" or "inherit".
+              if ( val && val !== "inherit" ) {
+                ret += " " + attrs[ i ].nodeName + "=" + dump.parse( val, "attribute" );
+              }
+            }
+          }
+          ret += close;
+
+          // Show content of TextNode or CDATASection
+          if ( node.nodeType === 3 || node.nodeType === 4 ) {
+            ret += node.nodeValue;
+          }
+
+          return ret + open + "/" + tag + close;
+        },
+
+        // function calls it internally, it's the arguments part of the function
+        functionArgs: function( fn ) {
+          var args,
+            l = fn.length;
+
+          if ( !l ) {
+            return "";
+          }
+
+          args = new Array( l );
+          while ( l-- ) {
+
+            // 97 is 'a'
+            args[ l ] = String.fromCharCode( 97 + l );
+          }
+          return " " + args.join( ", " ) + " ";
+        },
+        // object calls it internally, the key part of an item in a map
+        key: quote,
+        // function calls it internally, it's the content of the function
+        functionCode: "[code]",
+        // node calls it internally, it's an html attribute value
+        attribute: quote,
+        string: quote,
+        date: quote,
+        regexp: literal,
+        number: literal,
+        "boolean": literal
+      },
+      // if true, entities are escaped ( <, >, \t, space and \n )
+      HTML: false,
+      // indentation unit
+      indentChar: "  ",
+      // if true, items in a collection, are separated by a \n, else just a space.
+      multiline: true
+    };
+
+  return dump;
+}());
+
+// back compat
+QUnit.jsDump = QUnit.dump;
+
+// For browser, export only select globals
+if ( typeof window !== "undefined" ) {
+
+  // Deprecated
+  // Extend assert methods to QUnit and Global scope through Backwards compatibility
+  (function() {
+    var i,
+      assertions = Assert.prototype;
+
+    function applyCurrent( current ) {
+      return function() {
+        var assert = new Assert( QUnit.config.current );
+        current.apply( assert, arguments );
+      };
+    }
+
+    for ( i in assertions ) {
+      QUnit[ i ] = applyCurrent( assertions[ i ] );
+    }
+  })();
+
+  (function() {
+    var i, l,
+      keys = [
+        "test",
+        "module",
+        "expect",
+        "asyncTest",
+        "start",
+        "stop",
+        "ok",
+        "equal",
+        "notEqual",
+        "propEqual",
+        "notPropEqual",
+        "deepEqual",
+        "notDeepEqual",
+        "strictEqual",
+        "notStrictEqual",
+        "throws"
+      ];
+
+    for ( i = 0, l = keys.length; i < l; i++ ) {
+      window[ keys[ i ] ] = QUnit[ keys[ i ] ];
+    }
+  })();
+
+  window.QUnit = QUnit;
+}
+
+// For CommonJS environments, export everything
+if ( typeof module !== "undefined" && module.exports ) {
+  module.exports = QUnit;
+}
+
+// Get a reference to the global object, like window in browsers
+}( (function() {
+  return this;
+})() ));
+
+/*istanbul ignore next */
+/*
+ * Javascript Diff Algorithm
+ *  By John Resig (http://ejohn.org/)
+ *  Modified by Chu Alan "sprite"
+ *
+ * Released under the MIT license.
+ *
+ * More Info:
+ *  http://ejohn.org/projects/javascript-diff-algorithm/
+ *
+ * Usage: QUnit.diff(expected, actual)
+ *
+ * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the  quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
+ */
+QUnit.diff = (function() {
+  var hasOwn = Object.prototype.hasOwnProperty;
+
+  /*jshint eqeqeq:false, eqnull:true */
+  function diff( o, n ) {
+    var i,
+      ns = {},
+      os = {};
+
+    for ( i = 0; i < n.length; i++ ) {
+      if ( !hasOwn.call( ns, n[ i ] ) ) {
+        ns[ n[ i ] ] = {
+          rows: [],
+          o: null
+        };
+      }
+      ns[ n[ i ] ].rows.push( i );
+    }
+
+    for ( i = 0; i < o.length; i++ ) {
+      if ( !hasOwn.call( os, o[ i ] ) ) {
+        os[ o[ i ] ] = {
+          rows: [],
+          n: null
+        };
+      }
+      os[ o[ i ] ].rows.push( i );
+    }
+
+    for ( i in ns ) {
+      if ( hasOwn.call( ns, i ) ) {
+        if ( ns[ i ].rows.length === 1 && hasOwn.call( os, i ) && os[ i ].rows.length === 1 ) {
+          n[ ns[ i ].rows[ 0 ] ] = {
+            text: n[ ns[ i ].rows[ 0 ] ],
+            row: os[ i ].rows[ 0 ]
+          };
+          o[ os[ i ].rows[ 0 ] ] = {
+            text: o[ os[ i ].rows[ 0 ] ],
+            row: ns[ i ].rows[ 0 ]
+          };
+        }
+      }
+    }
+
+    for ( i = 0; i < n.length - 1; i++ ) {
+      if ( n[ i ].text != null && n[ i + 1 ].text == null && n[ i ].row + 1 < o.length && o[ n[ i ].row + 1 ].text == null &&
+        n[ i + 1 ] == o[ n[ i ].row + 1 ] ) {
+
+        n[ i + 1 ] = {
+          text: n[ i + 1 ],
+          row: n[ i ].row + 1
+        };
+        o[ n[ i ].row + 1 ] = {
+          text: o[ n[ i ].row + 1 ],
+          row: i + 1
+        };
+      }
+    }
+
+    for ( i = n.length - 1; i > 0; i-- ) {
+      if ( n[ i ].text != null && n[ i - 1 ].text == null && n[ i ].row > 0 && o[ n[ i ].row - 1 ].text == null &&
+        n[ i - 1 ] == o[ n[ i ].row - 1 ] ) {
+
+        n[ i - 1 ] = {
+          text: n[ i - 1 ],
+          row: n[ i ].row - 1
+        };
+        o[ n[ i ].row - 1 ] = {
+          text: o[ n[ i ].row - 1 ],
+          row: i - 1
+        };
+      }
+    }
+
+    return {
+      o: o,
+      n: n
+    };
+  }
+
+  return function( o, n ) {
+    o = o.replace( /\s+$/, "" );
+    n = n.replace( /\s+$/, "" );
+
+    var i, pre,
+      str = "",
+      out = diff( o === "" ? [] : o.split( /\s+/ ), n === "" ? [] : n.split( /\s+/ ) ),
+      oSpace = o.match( /\s+/g ),
+      nSpace = n.match( /\s+/g );
+
+    if ( oSpace == null ) {
+      oSpace = [ " " ];
+    } else {
+      oSpace.push( " " );
+    }
+
+    if ( nSpace == null ) {
+      nSpace = [ " " ];
+    } else {
+      nSpace.push( " " );
+    }
+
+    if ( out.n.length === 0 ) {
+      for ( i = 0; i < out.o.length; i++ ) {
+        str += "<del>" + out.o[ i ] + oSpace[ i ] + "</del>";
+      }
+    } else {
+      if ( out.n[ 0 ].text == null ) {
+        for ( n = 0; n < out.o.length && out.o[ n ].text == null; n++ ) {
+          str += "<del>" + out.o[ n ] + oSpace[ n ] + "</del>";
+        }
+      }
+
+      for ( i = 0; i < out.n.length; i++ ) {
+        if ( out.n[ i ].text == null ) {
+          str += "<ins>" + out.n[ i ] + nSpace[ i ] + "</ins>";
+        } else {
+
+          // `pre` initialized at top of scope
+          pre = "";
+
+          for ( n = out.n[ i ].row + 1; n < out.o.length && out.o[ n ].text == null; n++ ) {
+            pre += "<del>" + out.o[ n ] + oSpace[ n ] + "</del>";
+          }
+          str += " " + out.n[ i ].text + nSpace[ i ] + pre;
+        }
+      }
+    }
+
+    return str;
+  };
+}());
+
+(function() {
+
+// Deprecated QUnit.init - Ref #530
+// Re-initialize the configuration options
+QUnit.init = function() {
+  var tests, banner, result, qunit,
+    config = QUnit.config;
+
+  config.stats = { all: 0, bad: 0 };
+  config.moduleStats = { all: 0, bad: 0 };
+  config.started = 0;
+  config.updateRate = 1000;
+  config.blocking = false;
+  config.autostart = true;
+  config.autorun = false;
+  config.filter = "";
+  config.queue = [];
+  config.semaphore = 1;
+
+  // Return on non-browser environments
+  // This is necessary to not break on node tests
+  if ( typeof window === "undefined" ) {
+    return;
+  }
+
+  qunit = id( "qunit" );
+  if ( qunit ) {
+    qunit.innerHTML =
+      "<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
+      "<h2 id='qunit-banner'></h2>" +
+      "<div id='qunit-testrunner-toolbar'></div>" +
+      "<h2 id='qunit-userAgent'></h2>" +
+      "<ol id='qunit-tests'></ol>";
+  }
+
+  tests = id( "qunit-tests" );
+  banner = id( "qunit-banner" );
+  result = id( "qunit-testresult" );
+
+  if ( tests ) {
+    tests.innerHTML = "";
+  }
+
+  if ( banner ) {
+    banner.className = "";
+  }
+
+  if ( result ) {
+    result.parentNode.removeChild( result );
+  }
+
+  if ( tests ) {
+    result = document.createElement( "p" );
+    result.id = "qunit-testresult";
+    result.className = "result";
+    tests.parentNode.insertBefore( result, tests );
+    result.innerHTML = "Running...<br/>&nbsp;";
+  }
+};
+
+// Resets the test setup. Useful for tests that modify the DOM.
+/*
+DEPRECATED: Use multiple tests instead of resetting inside a test.
+Use testStart or testDone for custom cleanup.
+This method will throw an error in 2.0, and will be removed in 2.1
+*/
+QUnit.reset = function() {
+
+  // Return on non-browser environments
+  // This is necessary to not break on node tests
+  if ( typeof window === "undefined" ) {
+    return;
+  }
+
+  var fixture = id( "qunit-fixture" );
+  if ( fixture ) {
+    fixture.innerHTML = config.fixture;
+  }
+};
+
+// Don't load the HTML Reporter on non-Browser environments
+if ( typeof window === "undefined" ) {
+  return;
+}
+
+var config = QUnit.config,
+  hasOwn = Object.prototype.hasOwnProperty,
+  defined = {
+    document: typeof window.document !== "undefined",
+    sessionStorage: (function() {
+      var x = "qunit-test-string";
+      try {
+        sessionStorage.setItem( x, x );
+        sessionStorage.removeItem( x );
+        return true;
+      } catch ( e ) {
+        return false;
+      }
+    }())
+  };
+
+/**
+* Escape text for attribute or text content.
+*/
+function escapeText( s ) {
+  if ( !s ) {
+    return "";
+  }
+  s = s + "";
+
+  // Both single quotes and double quotes (for attributes)
+  return s.replace( /['"<>&]/g, function( s ) {
+    switch ( s ) {
+    case "'":
+      return "&#039;";
+    case "\"":
+      return "&quot;";
+    case "<":
+      return "&lt;";
+    case ">":
+      return "&gt;";
+    case "&":
+      return "&amp;";
+    }
+  });
+}
+
+/**
+ * @param {HTMLElement} elem
+ * @param {string} type
+ * @param {Function} fn
+ */
+function addEvent( elem, type, fn ) {
+  if ( elem.addEventListener ) {
+
+    // Standards-based browsers
+    elem.addEventListener( type, fn, false );
+  } else if ( elem.attachEvent ) {
+
+    // support: IE <9
+    elem.attachEvent( "on" + type, fn );
+  }
+}
+
+/**
+ * @param {Array|NodeList} elems
+ * @param {string} type
+ * @param {Function} fn
+ */
+function addEvents( elems, type, fn ) {
+  var i = elems.length;
+  while ( i-- ) {
+    addEvent( elems[ i ], type, fn );
+  }
+}
+
+function hasClass( elem, name ) {
+  return ( " " + elem.className + " " ).indexOf( " " + name + " " ) >= 0;
+}
+
+function addClass( elem, name ) {
+  if ( !hasClass( elem, name ) ) {
+    elem.className += ( elem.className ? " " : "" ) + name;
+  }
+}
+
+function toggleClass( elem, name ) {
+  if ( hasClass( elem, name ) ) {
+    removeClass( elem, name );
+  } else {
+    addClass( elem, name );
+  }
+}
+
+function removeClass( elem, name ) {
+  var set = " " + elem.className + " ";
+
+  // Class name may appear multiple times
+  while ( set.indexOf( " " + name + " " ) >= 0 ) {
+    set = set.replace( " " + name + " ", " " );
+  }
+
+  // trim for prettiness
+  elem.className = typeof set.trim === "function" ? set.trim() : set.replace( /^\s+|\s+$/g, "" );
+}
+
+function id( name ) {
+  return defined.document && document.getElementById && document.getElementById( name );
+}
+
+function getUrlConfigHtml() {
+  var i, j, val,
+    escaped, escapedTooltip,
+    selection = false,
+    len = config.urlConfig.length,
+    urlConfigHtml = "";
+
+  for ( i = 0; i < len; i++ ) {
+    val = config.urlConfig[ i ];
+    if ( typeof val === "string" ) {
+      val = {
+        id: val,
+        label: val
+      };
+    }
+
+    escaped = escapeText( val.id );
+    escapedTooltip = escapeText( val.tooltip );
+
+    config[ val.id ] = QUnit.urlParams[ val.id ];
+    if ( !val.value || typeof val.value === "string" ) {
+      urlConfigHtml += "<input id='qunit-urlconfig-" + escaped +
+        "' name='" + escaped + "' type='checkbox'" +
+        ( val.value ? " value='" + escapeText( val.value ) + "'" : "" ) +
+        ( config[ val.id ] ? " checked='checked'" : "" ) +
+        " title='" + escapedTooltip + "'><label for='qunit-urlconfig-" + escaped +
+        "' title='" + escapedTooltip + "'>" + val.label + "</label>";
+    } else {
+      urlConfigHtml += "<label for='qunit-urlconfig-" + escaped +
+        "' title='" + escapedTooltip + "'>" + val.label +
+        ": </label><select id='qunit-urlconfig-" + escaped +
+        "' name='" + escaped + "' title='" + escapedTooltip + "'><option></option>";
+
+      if ( QUnit.is( "array", val.value ) ) {
+        for ( j = 0; j < val.value.length; j++ ) {
+          escaped = escapeText( val.value[ j ] );
+          urlConfigHtml += "<option value='" + escaped + "'" +
+            ( config[ val.id ] === val.value[ j ] ?
+              ( selection = true ) && " selected='selected'" : "" ) +
+            ">" + escaped + "</option>";
+        }
+      } else {
+        for ( j in val.value ) {
+          if ( hasOwn.call( val.value, j ) ) {
+            urlConfigHtml += "<option value='" + escapeText( j ) + "'" +
+              ( config[ val.id ] === j ?
+                ( selection = true ) && " selected='selected'" : "" ) +
+              ">" + escapeText( val.value[ j ] ) + "</option>";
+          }
+        }
+      }
+      if ( config[ val.id ] && !selection ) {
+        escaped = escapeText( config[ val.id ] );
+        urlConfigHtml += "<option value='" + escaped +
+          "' selected='selected' disabled='disabled'>" + escaped + "</option>";
+      }
+      urlConfigHtml += "</select>";
+    }
+  }
+
+  return urlConfigHtml;
+}
+
+function toolbarUrlConfigContainer() {
+  var urlConfigContainer = document.createElement( "span" );
+
+  urlConfigContainer.innerHTML = getUrlConfigHtml();
+
+  // For oldIE support:
+  // * Add handlers to the individual elements instead of the container
+  // * Use "click" instead of "change" for checkboxes
+  // * Fallback from event.target to event.srcElement
+  addEvents( urlConfigContainer.getElementsByTagName( "input" ), "click", function( event ) {
+    var params = {},
+      target = event.target || event.srcElement;
+    params[ target.name ] = target.checked ?
+      target.defaultValue || true :
+      undefined;
+    window.location = QUnit.url( params );
+  });
+  addEvents( urlConfigContainer.getElementsByTagName( "select" ), "change", function( event ) {
+    var params = {},
+      target = event.target || event.srcElement;
+    params[ target.name ] = target.options[ target.selectedIndex ].value || undefined;
+    window.location = QUnit.url( params );
+  });
+
+  return urlConfigContainer;
+}
+
+function getModuleNames() {
+  var i,
+    moduleNames = [];
+
+  for ( i in config.modules ) {
+    if ( config.modules.hasOwnProperty( i ) ) {
+      moduleNames.push( i );
+    }
+  }
+
+  moduleNames.sort(function( a, b ) {
+    return a.localeCompare( b );
+  });
+
+  return moduleNames;
+}
+
+function toolbarModuleFilterHtml() {
+  var i,
+    moduleFilterHtml = "",
+    moduleNames = getModuleNames();
+
+  if ( moduleNames.length <= 1 ) {
+    return false;
+  }
+
+  moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label>" +
+    "<select id='qunit-modulefilter' name='modulefilter'><option value='' " +
+    ( config.module === undefined ? "selected='selected'" : "" ) +
+    ">< All Modules ></option>";
+
+  for ( i = 0; i < moduleNames.length; i++ ) {
+    moduleFilterHtml += "<option value='" +
+      escapeText( encodeURIComponent( moduleNames[ i ] ) ) + "' " +
+      ( config.module === moduleNames[ i ] ? "selected='selected'" : "" ) +
+      ">" + escapeText( moduleNames[ i ] ) + "</option>";
+  }
+  moduleFilterHtml += "</select>";
+
+  return moduleFilterHtml;
+}
+
+function toolbarModuleFilter() {
+  var moduleFilter = document.createElement( "span" ),
+    moduleFilterHtml = toolbarModuleFilterHtml();
+
+  if ( !moduleFilterHtml ) {
+    return false;
+  }
+
+  moduleFilter.setAttribute( "id", "qunit-modulefilter-container" );
+  moduleFilter.innerHTML = moduleFilterHtml;
+
+  addEvent( moduleFilter.lastChild, "change", function() {
+    var selectBox = moduleFilter.getElementsByTagName( "select" )[ 0 ],
+      selectedModule = decodeURIComponent( selectBox.options[ selectBox.selectedIndex ].value );
+
+    window.location = QUnit.url({
+      module: ( selectedModule === "" ) ? undefined : selectedModule,
+
+      // Remove any existing filters
+      filter: undefined,
+      testNumber: undefined
+    });
+  });
+
+  return moduleFilter;
+}
+
+function toolbarFilter() {
+  var testList = id( "qunit-tests" ),
+    filter = document.createElement( "input" );
+
+  filter.type = "checkbox";
+  filter.id = "qunit-filter-pass";
+
+  addEvent( filter, "click", function() {
+    if ( filter.checked ) {
+      addClass( testList, "hidepass" );
+      if ( defined.sessionStorage ) {
+        sessionStorage.setItem( "qunit-filter-passed-tests", "true" );
+      }
+    } else {
+      removeClass( testList, "hidepass" );
+      if ( defined.sessionStorage ) {
+        sessionStorage.removeItem( "qunit-filter-passed-tests" );
+      }
+    }
+  });
+
+  if ( config.hidepassed || defined.sessionStorage &&
+      sessionStorage.getItem( "qunit-filter-passed-tests" ) ) {
+    filter.checked = true;
+
+    addClass( testList, "hidepass" );
+  }
+
+  return filter;
+}
+
+function toolbarLabel() {
+  var label = document.createElement( "label" );
+  label.setAttribute( "for", "qunit-filter-pass" );
+  label.setAttribute( "title", "Only show tests and assertions that fail. Stored in sessionStorage." );
+  label.innerHTML = "Hide passed tests";
+
+  return label;
+}
+
+function appendToolbar() {
+  var moduleFilter,
+    toolbar = id( "qunit-testrunner-toolbar" );
+
+  if ( toolbar ) {
+    toolbar.appendChild( toolbarFilter() );
+    toolbar.appendChild( toolbarLabel() );
+    toolbar.appendChild( toolbarUrlConfigContainer() );
+
+    moduleFilter = toolbarModuleFilter();
+    if ( moduleFilter ) {
+      toolbar.appendChild( moduleFilter );
+    }
+  }
+}
+
+function appendBanner() {
+  var banner = id( "qunit-banner" );
+
+  if ( banner ) {
+    banner.className = "";
+    banner.innerHTML = "<a href='" +
+      QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) +
+      "'>" + banner.innerHTML + "</a> ";
+  }
+}
+
+function appendTestResults() {
+  var tests = id( "qunit-tests" ),
+    result = id( "qunit-testresult" );
+
+  if ( result ) {
+    result.parentNode.removeChild( result );
+  }
+
+  if ( tests ) {
+    tests.innerHTML = "";
+    result = document.createElement( "p" );
+    result.id = "qunit-testresult";
+    result.className = "result";
+    tests.parentNode.insertBefore( result, tests );
+    result.innerHTML = "Running...<br>&nbsp;";
+  }
+}
+
+function storeFixture() {
+  var fixture = id( "qunit-fixture" );
+  if ( fixture ) {
+    config.fixture = fixture.innerHTML;
+  }
+}
+
+function appendUserAgent() {
+  var userAgent = id( "qunit-userAgent" );
+  if ( userAgent ) {
+    userAgent.innerHTML = navigator.userAgent;
+  }
+}
+
+// HTML Reporter initialization and load
+QUnit.begin(function() {
+  var qunit = id( "qunit" );
+
+  if ( qunit ) {
+    qunit.innerHTML =
+    "<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
+    "<h2 id='qunit-banner'></h2>" +
+    "<div id='qunit-testrunner-toolbar'></div>" +
+    "<h2 id='qunit-userAgent'></h2>" +
+    "<ol id='qunit-tests'></ol>";
+  }
+
+  appendBanner();
+  appendTestResults();
+  appendUserAgent();
+  appendToolbar();
+  storeFixture();
+});
+
+QUnit.done(function( details ) {
+  var i, key,
+    banner = id( "qunit-banner" ),
+    tests = id( "qunit-tests" ),
+    html = [
+      "Tests completed in ",
+      details.runtime,
+      " milliseconds.<br>",
+      "<span class='passed'>",
+      details.passed,
+      "</span> assertions of <span class='total'>",
+      details.total,
+      "</span> passed, <span class='failed'>",
+      details.failed,
+      "</span> failed."
+    ].join( "" );
+
+  if ( banner ) {
+    banner.className = details.failed ? "qunit-fail" : "qunit-pass";
+  }
+
+  if ( tests ) {
+    id( "qunit-testresult" ).innerHTML = html;
+  }
+
+  if ( config.altertitle && defined.document && document.title ) {
+
+    // show ✖ for good, ✔ for bad suite result in title
+    // use escape sequences in case file gets loaded with non-utf-8-charset
+    document.title = [
+      ( details.failed ? "\u2716" : "\u2714" ),
+      document.title.replace( /^[\u2714\u2716] /i, "" )
+    ].join( " " );
+  }
+
+  // clear own sessionStorage items if all tests passed
+  if ( config.reorder && defined.sessionStorage && details.failed === 0 ) {
+    for ( i = 0; i < sessionStorage.length; i++ ) {
+      key = sessionStorage.key( i++ );
+      if ( key.indexOf( "qunit-test-" ) === 0 ) {
+        sessionStorage.removeItem( key );
+      }
+    }
+  }
+
+  // scroll back to top to show results
+  if ( config.scrolltop && window.scrollTo ) {
+    window.scrollTo( 0, 0 );
+  }
+});
+
+function getNameHtml( name, module ) {
+  var nameHtml = "";
+
+  if ( module ) {
+    nameHtml = "<span class='module-name'>" + escapeText( module ) + "</span>: ";
+  }
+
+  nameHtml += "<span class='test-name'>" + escapeText( name ) + "</span>";
+
+  return nameHtml;
+}
+
+QUnit.testStart(function( details ) {
+  var a, b, li, running, assertList,
+    name = getNameHtml( details.name, details.module ),
+    tests = id( "qunit-tests" );
+
+  if ( tests ) {
+    b = document.createElement( "strong" );
+    b.innerHTML = name;
+
+    a = document.createElement( "a" );
+    a.innerHTML = "Rerun";
+    a.href = QUnit.url({ testNumber: details.testNumber });
+
+    li = document.createElement( "li" );
+    li.appendChild( b );
+    li.appendChild( a );
+    li.className = "running";
+    li.id = "qunit-test-output" + details.testNumber;
+
+    assertList = document.createElement( "ol" );
+    assertList.className = "qunit-assert-list";
+
+    li.appendChild( assertList );
+
+    tests.appendChild( li );
+  }
+
+  running = id( "qunit-testresult" );
+  if ( running ) {
+    running.innerHTML = "Running: <br>" + name;
+  }
+
+});
+
+QUnit.log(function( details ) {
+  var assertList, assertLi,
+    message, expected, actual,
+    testItem = id( "qunit-test-output" + details.testNumber );
+
+  if ( !testItem ) {
+    return;
+  }
+
+  message = escapeText( details.message ) || ( details.result ? "okay" : "failed" );
+  message = "<span class='test-message'>" + message + "</span>";
+
+  // pushFailure doesn't provide details.expected
+  // when it calls, it's implicit to also not show expected and diff stuff
+  // Also, we need to check details.expected existence, as it can exist and be undefined
+  if ( !details.result && hasOwn.call( details, "expected" ) ) {
+    expected = escapeText( QUnit.dump.parse( details.expected ) );
+    actual = escapeText( QUnit.dump.parse( details.actual ) );
+    message += "<table><tr class='test-expected'><th>Expected: </th><td><pre>" +
+      expected +
+      "</pre></td></tr>";
+
+    if ( actual !== expected ) {
+      message += "<tr class='test-actual'><th>Result: </th><td><pre>" +
+        actual + "</pre></td></tr>" +
+        "<tr class='test-diff'><th>Diff: </th><td><pre>" +
+        QUnit.diff( expected, actual ) + "</pre></td></tr>";
+    }
+
+    if ( details.source ) {
+      message += "<tr class='test-source'><th>Source: </th><td><pre>" +
+        escapeText( details.source ) + "</pre></td></tr>";
+    }
+
+    message += "</table>";
+
+  // this occours when pushFailure is set and we have an extracted stack trace
+  } else if ( !details.result && details.source ) {
+    message += "<table>" +
+      "<tr class='test-source'><th>Source: </th><td><pre>" +
+      escapeText( details.source ) + "</pre></td></tr>" +
+      "</table>";
+  }
+
+  assertList = testItem.getElementsByTagName( "ol" )[ 0 ];
+
+  assertLi = document.createElement( "li" );
+  assertLi.className = details.result ? "pass" : "fail";
+  assertLi.innerHTML = message;
+  assertList.appendChild( assertLi );
+});
+
+QUnit.testDone(function( details ) {
+  var testTitle, time, testItem, assertList,
+    good, bad, testCounts,
+    tests = id( "qunit-tests" );
+
+  // QUnit.reset() is deprecated and will be replaced for a new
+  // fixture reset function on QUnit 2.0/2.1.
+  // It's still called here for backwards compatibility handling
+  QUnit.reset();
+
+  if ( !tests ) {
+    return;
+  }
+
+  testItem = id( "qunit-test-output" + details.testNumber );
+  assertList = testItem.getElementsByTagName( "ol" )[ 0 ];
+
+  good = details.passed;
+  bad = details.failed;
+
+  // store result when possible
+  if ( config.reorder && defined.sessionStorage ) {
+    if ( bad ) {
+      sessionStorage.setItem( "qunit-test-" + details.module + "-" + details.name, bad );
+    } else {
+      sessionStorage.removeItem( "qunit-test-" + details.module + "-" + details.name );
+    }
+  }
+
+  if ( bad === 0 ) {
+    addClass( assertList, "qunit-collapsed" );
+  }
+
+  // testItem.firstChild is the test name
+  testTitle = testItem.firstChild;
+
+  testCounts = bad ?
+    "<b class='failed'>" + bad + "</b>, " + "<b class='passed'>" + good + "</b>, " :
+    "";
+
+  testTitle.innerHTML += " <b class='counts'>(" + testCounts +
+    details.assertions.length + ")</b>";
+
+  addEvent( testTitle, "click", function() {
+    toggleClass( assertList, "qunit-collapsed" );
+  });
+
+  time = document.createElement( "span" );
+  time.className = "runtime";
+  time.innerHTML = details.runtime + " ms";
+
+  testItem.className = bad ? "fail" : "pass";
+
+  testItem.insertBefore( time, assertList );
+});
+
+if ( !defined.document || document.readyState === "complete" ) {
+  config.autorun = true;
+}
+
+if ( defined.document ) {
+  addEvent( window, "load", QUnit.load );
+}
+
+})();

+ 29 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/tests.js

@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var folderOrder = [
+  'test'
+];
+
+folderOrder.forEach(function(folder) {
+  window.require.list().filter(function(module) {
+    return new RegExp('^' + folder + '/').test(module);
+  }).forEach(function(module) {
+      require(module);
+    });
+});

+ 237 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/stylesheets/qunit.css

@@ -0,0 +1,237 @@
+/*!
+ * QUnit 1.15.0
+ * http://qunitjs.com/
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2014-08-08T16:00Z
+ */
+
+/** Font Family and Sizes */
+
+#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
+	font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
+}
+
+#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
+#qunit-tests { font-size: smaller; }
+
+
+/** Resets */
+
+#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
+	margin: 0;
+	padding: 0;
+}
+
+
+/** Header */
+
+#qunit-header {
+	padding: 0.5em 0 0.5em 1em;
+
+	color: #8699A4;
+	background-color: #0D3349;
+
+	font-size: 1.5em;
+	line-height: 1em;
+	font-weight: 400;
+
+	border-radius: 5px 5px 0 0;
+}
+
+#qunit-header a {
+	text-decoration: none;
+	color: #C2CCD1;
+}
+
+#qunit-header a:hover,
+#qunit-header a:focus {
+	color: #FFF;
+}
+
+#qunit-testrunner-toolbar label {
+	display: inline-block;
+	padding: 0 0.5em 0 0.1em;
+}
+
+#qunit-banner {
+	height: 5px;
+}
+
+#qunit-testrunner-toolbar {
+	padding: 0.5em 1em 0.5em 1em;
+	color: #5E740B;
+	background-color: #EEE;
+	overflow: hidden;
+}
+
+#qunit-userAgent {
+	padding: 0.5em 1em 0.5em 1em;
+	background-color: #2B81AF;
+	color: #FFF;
+	text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
+}
+
+#qunit-modulefilter-container {
+	float: right;
+}
+
+/** Tests: Pass/Fail */
+
+#qunit-tests {
+	list-style-position: inside;
+}
+
+#qunit-tests li {
+	padding: 0.4em 1em 0.4em 1em;
+	border-bottom: 1px solid #FFF;
+	list-style-position: inside;
+}
+
+#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running  {
+	display: none;
+}
+
+#qunit-tests li strong {
+	cursor: pointer;
+}
+
+#qunit-tests li a {
+	padding: 0.5em;
+	color: #C2CCD1;
+	text-decoration: none;
+}
+#qunit-tests li a:hover,
+#qunit-tests li a:focus {
+	color: #000;
+}
+
+#qunit-tests li .runtime {
+	float: right;
+	font-size: smaller;
+}
+
+.qunit-assert-list {
+	margin-top: 0.5em;
+	padding: 0.5em;
+
+	background-color: #FFF;
+
+	border-radius: 5px;
+}
+
+.qunit-collapsed {
+	display: none;
+}
+
+#qunit-tests table {
+	border-collapse: collapse;
+	margin-top: 0.2em;
+}
+
+#qunit-tests th {
+	text-align: right;
+	vertical-align: top;
+	padding: 0 0.5em 0 0;
+}
+
+#qunit-tests td {
+	vertical-align: top;
+}
+
+#qunit-tests pre {
+	margin: 0;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+#qunit-tests del {
+	background-color: #E0F2BE;
+	color: #374E0C;
+	text-decoration: none;
+}
+
+#qunit-tests ins {
+	background-color: #FFCACA;
+	color: #500;
+	text-decoration: none;
+}
+
+/*** Test Counts */
+
+#qunit-tests b.counts                       { color: #000; }
+#qunit-tests b.passed                       { color: #5E740B; }
+#qunit-tests b.failed                       { color: #710909; }
+
+#qunit-tests li li {
+	padding: 5px;
+	background-color: #FFF;
+	border-bottom: none;
+	list-style-position: inside;
+}
+
+/*** Passing Styles */
+
+#qunit-tests li li.pass {
+	color: #3C510C;
+	background-color: #FFF;
+	border-left: 10px solid #C6E746;
+}
+
+#qunit-tests .pass                          { color: #528CE0; background-color: #D2E0E6; }
+#qunit-tests .pass .test-name               { color: #366097; }
+
+#qunit-tests .pass .test-actual,
+#qunit-tests .pass .test-expected           { color: #999; }
+
+#qunit-banner.qunit-pass                    { background-color: #C6E746; }
+
+/*** Failing Styles */
+
+#qunit-tests li li.fail {
+	color: #710909;
+	background-color: #FFF;
+	border-left: 10px solid #EE5757;
+	white-space: pre;
+}
+
+#qunit-tests > li:last-child {
+	border-radius: 0 0 5px 5px;
+}
+
+#qunit-tests .fail                          { color: #000; background-color: #EE5757; }
+#qunit-tests .fail .test-name,
+#qunit-tests .fail .module-name             { color: #000; }
+
+#qunit-tests .fail .test-actual             { color: #EE5757; }
+#qunit-tests .fail .test-expected           { color: #008000; }
+
+#qunit-banner.qunit-fail                    { background-color: #EE5757; }
+
+
+/** Result */
+
+#qunit-testresult {
+	padding: 0.5em 1em 0.5em 1em;
+
+	color: #2B81AF;
+	background-color: #D2E0E6;
+
+	border-bottom: 1px solid #FFF;
+}
+#qunit-testresult .module-name {
+	font-weight: 700;
+}
+
+/** Fixture */
+
+#qunit-fixture {
+	position: absolute;
+	top: -10000px;
+	left: -10000px;
+	width: 1000px;
+	height: 1000px;
+}

+ 46 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/assets/tests.html

@@ -0,0 +1,46 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Pig tests</title>
+  <link rel="stylesheet" href="static/stylesheets/qunit.css">
+</head>
+<body>
+  <div id="qunit"></div>
+  <div id="qunit-fixture"></div>
+  <div id="ember-testing"></div>
+  <script src="static/javascripts/qunit.js"></script>
+  <script src="static/javascripts/vendor.js"></script>
+  <script src="static/javascripts/jquery.mockjax.js"></script>
+  <script src="static/javascripts/ember-qunit.js"></script>
+  <script src="static/javascripts/app.js"></script>
+  <script>
+    emq.globalize();
+    require('initialize');
+    App.setupForTesting();
+    App.injectTestHelpers();
+    setResolver(Em.DefaultResolver.create({ namespace: App }));
+    App.rootElement = '#ember-testing';
+  </script>
+  <script src="static/javascripts/test.js"></script>
+  <script src="static/javascripts/tests.js"></script>
+</body>
+</html>

+ 38 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/components/codeMirror.js

@@ -22,6 +22,7 @@ App.CodeMirrorComponent = Ember.Component.extend({
   tagName: "textarea",
   readOnly:false,
   codeMirror:null,
+  fullscreen:false,
   updateCM:function () {
     var cm = this.get('codeMirror');
     if (this.get('readOnly')) {
@@ -39,28 +40,62 @@ App.CodeMirrorComponent = Ember.Component.extend({
       cmElement.addClass('inactive');
     }
   }.observes('codeMirror', 'content.didLoad'),
+  toggleFullScreen:function () {
+    Em.run.next(this,function () {
+      this.get('codeMirror').setOption("fullScreen", this.get('fullscreen'));
+    });
+  }.observes('fullscreen'),
   didInsertElement: function() {
     var cm = CodeMirror.fromTextArea(this.get('element'),{
       lineNumbers: true,
       matchBrackets: true,
       indentUnit: 4,
-      keyMap: "emacs"
+      keyMap: "emacs",
+      mode: "text/x-pig",
+      extraKeys: {
+        "Ctrl-Space": function (cm) {
+          if (!cm.getOption('readOnly')) {
+            cm.showHint({completeSingle:false});
+          }
+        },
+        "F11": function(cm) {
+          this.set('fullscreen',!this.get("fullscreen"));
+        }.bind(this),
+        "Esc": function(cm) {
+          if (this.get("fullscreen")) this.set("fullscreen", false);
+        }.bind(this)
+      }
     });
 
+    var updateToggle = function () {
+      var addMargin = $('.CodeMirror-vscrollbar').css('display') === "block";
+      var margin = $('.CodeMirror-vscrollbar').width();
+      $('.fullscreen-toggle').css('right',((addMargin)?3+margin:3));
+    }
+
+    cm.on('viewportChange',updateToggle);
+
     $('.editor-container').resizable({
       stop:function () {
         cm.setSize(null, this.style.height);
+        updateToggle();
       },
       resize: function() {
         this.getElementsByClassName('CodeMirror')[0].style.height = this.style.height;
         this.getElementsByClassName('CodeMirror-gutters')[0].style.height = this.style.height;
       },
-      minHeight:215,
+      minHeight:218,
       handles: {'s': '#sgrip' }
     });
 
     this.set('codeMirror',cm);
     if (!this.get('readOnly')) {
+      cm.on('keyup',function (cm, e) {
+        var inp = String.fromCharCode(e.keyCode);
+        if (e.type == "keyup" && /[a-zA-Z0-9-_ ]/.test(inp)) {
+          cm.showHint({completeSingle:false});
+        }
+      });
       cm.focus();
       cm.on('change', Em.run.bind(this,this.editorDidChange));
     }
@@ -78,6 +113,7 @@ App.CodeMirrorComponent = Ember.Component.extend({
     }
   }.observes('content.fileContent'),
   willClearRender:function () {
+    this.set('fullscreen', false);
     this.get('codeMirror').toTextArea();
   }
 });

+ 1 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/components/jobProgress.js

@@ -26,7 +26,7 @@ App.JobProgressComponent = Em.Component.extend({
   },
   update:function () {
     var progress = (!this.get('job.isTerminated'))?this.get('job.percentStatus'):100;
-    $(this.get('element')).find('.progress-bar').css('width',progress+'%');
+    this.$().find('.progress-bar').css('width',progress+'%');
   }.observes('job.percentStatus'),
   layout:Em.Handlebars.compile('<div {{bind-attr class=":progress-bar job.isTerminated:progress-bar-danger:progress-bar-success" }}role="progressbar"></div>')
 });

+ 2 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/components/pigHelper.js

@@ -43,8 +43,8 @@ App.PigHelperComponent = Em.Component.extend({
     }
   },
   findPosition: function (curLine){
-    var pos= curLine.indexOf("%");
-    var posArr=[];
+    var pos = curLine.indexOf("%");
+    var posArr = [];
     while(pos > -1) {
       posArr.push(pos);
       pos = curLine.indexOf("%", pos+1);

+ 1 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmAway.js

@@ -37,7 +37,7 @@ App.ConfirmAwayController = Ember.ObjectController.extend({
         script.rollback();
         file.rollback();
         this.get('waitingTransition').retry();
-      }.bind(this))
+      }.bind(this));
     }
   },
   saveCallback:function(response){

+ 15 - 16
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createScript.js

@@ -22,31 +22,30 @@ App.CreateScriptController = Ember.ObjectController.extend({
   needs:['pigScripts'],
   filePath:'',
   clearFilePath:function () {
-    this.set('didInsertTtle',false);
     this.set('filePath','');
+    this.set('titleErrorMessage','');
   }.observes('content'),
   actions:{
     confirm:function () {
-      var title = this.get('content.title');
-      if (!title) {
-        this.set('error', Em.I18n.t('scripts.modal.error_empty_title'));
-        return;
-      }
       this.get('controllers.pigScripts').send('confirmcreate',this.get('content'),this.get('filePath'));
     },
     cancel:function (script) {
       this.get('content').deleteRecord();
     }
   },
-  didInsertTtle:false,
-  titleError:function () {
-    var title = this.get('content.title');
-
-    if (!title && this.get('didInsertTtle')) {
-      return Em.I18n.t('scripts.modal.error_empty_title');
-    } else {
-      this.set('didInsertTtle',true);
+  titleErrorMessage:'',
+  clearAlert:function () {
+    if (!this.get('content.isBlankTitle')) {
+      this.set('titleErrorMessage','');
     }
-    return '';
-  }.property('content.title')
+  }.observes('content.title'),
+  titleChange:function () {
+    var target = this.get('targetObject');
+    var message = (Ember.isBlank(target.get('content.title')))?Em.I18n.t('scripts.modal.error_empty_title'):'';
+
+    target.set('titleErrorMessage',message);
+  },
+  isValid:function () {
+    return !this.get('content.isBlankTitle');
+  }.property('content.isBlankTitle')
 });

+ 2 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createUdf.js

@@ -28,7 +28,7 @@ App.CreateUdfController = Ember.ObjectController.extend({
       this.get('content').deleteRecord();
     }
   },
-  udfInvalid:function (argument) {
-    return !this.get('content.name') || !this.get('content.path');
+  isValid:function () {
+    return !Em.isBlank(this.get('content.name')) && !Em.isBlank(this.get('content.path'));
   }.property('content.name','content.path')
 });

+ 28 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteUdf.js

@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.DeleteUdfController = Ember.ObjectController.extend({
+  needs:['pigUdfs'],
+  actions:{
+    confirm:function () {
+      this.get('controllers.pigUdfs').send('deleteUdf',this.get('content'));
+    }
+  }
+});

+ 7 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/pigModal.js

@@ -44,7 +44,13 @@ App.PigModalComponent = Ember.Component.extend({
   },
   keyUp:function (e) {
     if (e.keyCode == 27) {
-      this.sendAction('close');
+      return this.sendAction('close');
+    }
+  },
+  keyDown:function (e) {
+    if (e.keyCode == 13 && this.get('targetObject.isValid')) {
+      this.$('.modal').modal('hide');
+      return this.sendAction('ok');
     }
   },
   show: function() {

+ 2 - 6
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js

@@ -31,9 +31,7 @@ App.PigController = Em.ArrayController.extend({
           this.send('showAlert', {'message':Em.I18n.t('scripts.alert.script_saved',{title: script.get('title')}),status:'success'});
         }.bind(this),
         onFail = function(error){
-          var trace = null;
-          if (error && error.responseJSON.trace)
-            trace = error.responseJSON.trace;
+          var trace = (error && error.responseJSON.trace)?error.responseJSON.trace:null;
           this.send('showAlert', {'message':Em.I18n.t('scripts.alert.save_error'),status:'error',trace:trace});
         }.bind(this);
 
@@ -50,9 +48,7 @@ App.PigController = Em.ArrayController.extend({
             this.send('showAlert', {'message':Em.I18n.t('scripts.alert.script_deleted',{title : model.get('title')}),status:'success'});
           }.bind(this);
       var onFail = function(error){
-            var trace = null;
-            if (error && error.responseJSON.trace)
-              trace = error.responseJSON.trace;
+            var trace = (error && error.responseJSON.trace)?error.responseJSON.trace:null;
             this.send('showAlert', {'message':Em.I18n.t('scripts.alert.delete_failed'),status:'error',trace:trace});
           }.bind(this);
       script.deleteRecord();

+ 1 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js

@@ -23,7 +23,7 @@ App.PigAlertController = Ember.ArrayController.extend({
   needs: ['pigErrorLog'],
   actions:{
     removeAlertObject:function (alert) {
-      this.content.removeObject(alert)
+      this.content.removeObject(alert);
     },
     showErrorLog:function (context) {
       errorLogController = this.get('controllers.pigErrorLog');

+ 1 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigScripts.js

@@ -36,7 +36,7 @@ App.PigScriptsController = Em.ArrayController.extend(App.Pagination,{
           var file = this.store.createRecord('file',{
             id:filePath,
             fileContent:''
-          })
+          });
         } catch (e) {
           return this.createScriptError(script,e);
         }

+ 7 - 9
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigUdfs.js

@@ -26,6 +26,9 @@ App.PigUdfsController = Em.ArrayController.extend(App.Pagination,{
     createUdf:function (udf) {
       return udf.save().then(this.onCreateSuccess.bind(this),this.onCreateFail.bind(this));
     },
+    deleteUdfModal:function(udf){
+      return this.send('openModal','deleteUdf',udf);
+    },
     deleteUdf:function(udf){
       udf.deleteRecord();
       return udf.save().then(this.onDeleteSuccess.bind(this),this.onDeleteFail.bind(this));
@@ -38,13 +41,11 @@ App.PigUdfsController = Em.ArrayController.extend(App.Pagination,{
     });
   },
   onCreateFail:function (error) {
-    var trace = null;
-    if (error && error.responseJSON.trace) {
-      trace = error.responseJSON.trace;
-    }
+    var trace = (error && error.responseJSON.trace)?error.responseJSON.trace:null;
     this.send('showAlert', {
       message:Em.I18n.t('udfs.alert.create_failed'),
-      status:'error',trace:trace
+      status:'error',
+      trace:trace
     });
   },
   onDeleteSuccess: function(model){
@@ -54,10 +55,7 @@ App.PigUdfsController = Em.ArrayController.extend(App.Pagination,{
     });
   },
   onDeleteFail:function(error){
-    var trace = null;
-    if (error && error.responseJSON.trace)
-      trace = error.responseJSON.trace;
-
+    var trace = (error && error.responseJSON.trace)?error.responseJSON.trace:null;
     this.send('showAlert', {
       message: Em.I18n.t('udfs.alert.delete_failed'),
       status:'error',

+ 12 - 7
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/script.js

@@ -38,7 +38,7 @@ App.ScriptController = Em.ObjectController.extend({
   },
 
   deleteJobSuccess:function (data) {
-    this.send('showAlert', {message:Em.I18n.t('job.alert.job_deleted'),status:'info'})
+    this.send('showAlert', {message:Em.I18n.t('job.alert.job_deleted'),status:'info'});
   },
   deleteJobFailed:function (job,error) {
     var trace = (error.responseJSON)?error.responseJSON.trace:null;
@@ -58,14 +58,19 @@ App.ScriptController = Em.ObjectController.extend({
   staticTabs:function () {
     return [
       {label:'Script',name:'script',url:'script.edit',target:this.get('controllers.pig.activeScript.id')},
-      {label:'History',name:'history',url:'script.history',target:this.get('controllers.pig.activeScript.id')},
+      {label:'History',name:'history',url:'script.history',target:this.get('controllers.pig.activeScript.id')}
     ];
   }.property('controllers.pig.activeScript.id'),
 
   jobTabs:function () {
     var jobTabs = [];
     this.get('activeJobs').forEach(function (job) {
-      jobTabs.push({label:job.get('title') + ' - ' + job.get('status').decamelize().capitalize(), name:job.get('id'),url:'script.job',target:job.get('id')})
+      jobTabs.push({
+        label:job.get('title') + ' - ' + job.get('status').decamelize().capitalize(),
+        name:job.get('id'),
+        url:'script.job',
+        target:job.get('id')
+      });
     });
     return jobTabs;
   }.property('activeJobs.[]','activeJobs.@each.status'),
@@ -81,15 +86,15 @@ App.ScriptController = Em.ObjectController.extend({
       this.onPoll();
     },
     stop: function(){
-      Em.run.cancel(this.get('timer'))
+      Em.run.cancel(this.get('timer'));
     },
     onPoll: function() {
       this.get('jobs').forEach(function (job) {
         if (job.get('needsPing')) {
           job.reload();
         } else {
-          this.jobs.removeObject(job)
-        };
+          this.jobs.removeObject(job);
+        }
       }.bind(this));
 
       if (this.get('jobs.length') > 0) {
@@ -112,6 +117,6 @@ App.ScriptController = Em.ObjectController.extend({
   activeJobsWatcher:function () {
     if (this.get('activeJobs.firstObject.scriptId') != this.get('controllers.pig.activeScript.id')) {
       this.set('activeJobs',[]);
-    };
+    }
   }.observes('controllers.pig.activeScript.id')
 });

+ 12 - 8
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js

@@ -26,6 +26,7 @@ App.ScriptEditController = Em.ObjectController.extend({
   titleWarn:false,
   tmpArgument:'',
   editor:null,
+  fullscreen:false,
 
   handleRenaming:function () {
     if (this.get('content.title')) {
@@ -53,28 +54,28 @@ App.ScriptEditController = Em.ObjectController.extend({
       }
     } else {
       controller.set('pigParams',[]);
-    };
+    }
   }.observes('content.pigScript.fileContent','content.id'),
 
 
   oldTitle:'',
   actions: {
     rename:function (opt) {
-      var changedAttributes = this.get('content').changedAttributes()
+      var changedAttributes = this.get('content').changedAttributes();
 
-      if (opt==='ask') {
+      if (opt === 'ask') {
         this.set('oldTitle',this.get('content.title'));
         this.set('isRenaming',true);
-      };
+      }
 
-      if (opt==='cancel') {
+      if (opt === 'cancel') {
         this.set('content.title',this.get('oldTitle'));
         this.set('oldTitle','');
         this.set('isRenaming',false);
-      };
+      }
 
-      if (opt==='confirm') {
-        if (Em.isArray(changedAttributes.title) && this.get('content.title')) {
+      if (opt === this.get('content.title') && !Em.isBlank(this.get('content.title'))) {
+        if (Em.isArray(changedAttributes.title)) {
           this.get('content').save().then(function () {
             this.send('showAlert', {message:Em.I18n.t('editor.title_updated'),status:'success'});
           }.bind(this));
@@ -117,6 +118,9 @@ App.ScriptEditController = Em.ObjectController.extend({
         .then(executeMethod[operation].bind(this))
         .then(this.executeSuccess.bind(this), this.executeError.bind(this))
         .finally(Em.run.bind(this,this.set,'isExec',false));
+    },
+    fullscreen:function () {
+      this.toggleProperty('fullscreen');
     }
   },
 

+ 4 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptJob.js

@@ -19,6 +19,7 @@
 var App = require('app');
 
 App.ScriptJobController = Em.ObjectController.extend(App.FileHandler,{
+  fullscreen:false,
   scriptContents:function () {
     var promise = new Ember.RSVP.Promise(function(resolve,reject){
       return this.get('content.pigScript').then(function (pigScript) {
@@ -60,6 +61,9 @@ App.ScriptJobController = Em.ObjectController.extend(App.FileHandler,{
       var file = (opt == 'results')?'jobResults.content.fileContent':'jobLogs.content.fileContent';
       var suffix = (opt == 'results')?'_results.txt':'_logs.txt';
       return this.downloadFile(this.get(file), this.get("suggestedFilenamePrefix")+suffix);
+    },
+    fullscreen:function () {
+      this.toggleProperty('fullscreen');
     }
   }
 });

+ 1 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js

@@ -23,7 +23,7 @@ App.SplashController = Ember.ObjectController.extend({
     toggleStackTrace:function () {
       var value = this.get('isExpanded');
       this.set('isExpanded', !value);
-    },
+    }
   },
   isExpanded: false,
 

+ 4 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js

@@ -68,10 +68,10 @@ App.register('lib:fileSaver', App.FileSaver);
 
 
 Ember.Handlebars.registerBoundHelper('showDate', function(date,format) {
-  return moment(date).format(format)
+  return moment(date).format(format);
 });
 
-Em.TextField.reopen(Em.I18n.TranslateableAttributes)
+Em.TextField.reopen(Em.I18n.TranslateableAttributes);
 
 require('translations');
 require('router');
@@ -113,6 +113,7 @@ require("controllers/errorLog");
 require("controllers/modal/confirmAway");
 require("controllers/modal/confirmDelete");
 require("controllers/modal/deleteJob");
+require("controllers/modal/deleteUdf");
 require("controllers/modal/createScript");
 require("controllers/modal/createUdf");
 require("controllers/modal/gotoCopy");
@@ -140,6 +141,7 @@ require("templates/modal/confirmAway");
 require("templates/modal/confirmDelete");
 require("templates/modal/createScript");
 require("templates/modal/deleteJob");
+require("templates/modal/deleteUdf");
 require("templates/modal/createUdf");
 require("templates/modal/gotoCopy");
 require("templates/modal/logDownload");

+ 2 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/fileHandler.js

@@ -29,14 +29,14 @@ var _promise = function (controller, url, output) {
         controller.send('showAlert', {'message': Em.I18n.t('job.alert.promise_error',
           {status:response.status, message:response.message}), status:'error', trace: response.trace});
       }
-    })
+    });
   });
 };
 
 App.FileHandler = Ember.Mixin.create({
   fileProxy:function (url) {
     var promise,
-        host = this.store.adapterFor('application').get('host');
+        host = this.store.adapterFor('application').get('host'),
         namespace = this.store.adapterFor('application').get('namespace');
 
     url = [host, namespace, url].join('/');

+ 2 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/pagination.js

@@ -38,7 +38,7 @@ App.Pagination = Ember.Mixin.create({
   pageWatcher:function () {
     if (this.get('page') > this.get('totalPages')) {
       this.set('page',this.get('totalPages') || 1);
-    };
+    }
   }.observes('totalPages'),
 
   totalPages: function() {
@@ -94,6 +94,6 @@ App.Pagination = Ember.Mixin.create({
   paginationInfo: function () {
     var start = (this.get('page') - 1) * this.get('perPage') + 1;
     var end = start + this.get('paginatedContent.length') - 1;
-    return start + ' - ' + end + ' of ' + this.get('arrangedContent.length')
+    return start + ' - ' + end + ' of ' + this.get('arrangedContent.length');
   }.property('page', 'arrangedContent.length', 'perPage')
 });

+ 1 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/models/file.js

@@ -22,5 +22,5 @@ App.File = DS.Model.extend({
   fileContent: DS.attr('string'),
   hasNext:DS.attr('boolean'),
   page:DS.attr('number'),
-  pageCount:DS.attr('number'),
+  pageCount:DS.attr('number')
 });

+ 1 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_job.js

@@ -57,7 +57,7 @@ App.Job = DS.Model.extend({
     var namespace = self.store.adapterFor('application').get('namespace');
     var url = [host, namespace,'jobs',self.get('id')].join('/');
 
-    self.set('isKilling',true)
+    self.set('isKilling',true);
     return Em.$.ajax(url, {
       type:'DELETE',
       contentType:'application/json',

+ 6 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_script.js

@@ -22,7 +22,7 @@ App.Script = DS.Model.extend({
   title:DS.attr('string'),
   pigScript:DS.belongsTo('file', { async: true }),
   dateCreated:DS.attr('isodate', { defaultValue: moment()}),
-  templetonArguments:DS.attr('string', { defaultValue: '-useHCatalog'}),
+  templetonArguments:DS.attr('string'),
   // nav item identifier
   name:function (q){
     return this.get('title')+this.get('id');
@@ -44,5 +44,9 @@ App.Script = DS.Model.extend({
 
   dateCreatedUnix:function () {
     return moment(this.get('dateCreated')).unix();
-  }.property('dateCreated')
+  }.property('dateCreated'),
+
+  isBlankTitle:function () {
+    return Ember.isBlank(this.get('title'));
+  }.property('title')
 });

+ 3 - 3
contrib/views/pig/src/main/resources/ui/pig-web/app/routes/script.js

@@ -49,11 +49,11 @@ App.ScriptRoute = Em.Route.extend({
       var targetParams = transition.params[transition.targetName];
       if (targetParams['script_id']) {
         return targetParams['script_id'] != this.controllerFor('pig').get('activeScriptId');
-      };
+      }
       if (targetParams['job_id'] && this.modelFor('script.history')) {
         return this.modelFor('script.history').get('content').filterBy('id',targetParams['job_id']).length == 0;
-      };
-    };
+      }
+    }
     return isScriptAway;
   }
 });

+ 1 - 3
contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptJob.js

@@ -37,9 +37,7 @@ App.ScriptJobRoute = Em.Route.extend({
           job.reload();
           self.send('showAlert', {'message': Em.I18n.t('job.alert.job_killed',{title:self.get('title')}), status:'info'});
         },function (reason) {
-          var trace = null;
-          if (reason && reason.responseJSON.trace)
-            trace = reason.responseJSON.trace;
+          var trace = (reason && reason.responseJSON.trace)?reason.responseJSON.trace:null;
           self.send('showAlert', {'message': Em.I18n.t('job.alert.job_kill_error'), status:'error', trace:trace});
         });
       }

+ 116 - 19
contrib/views/pig/src/main/resources/ui/pig-web/app/styles/style.less

@@ -320,16 +320,29 @@
     }
     .CodeMirror {
       .common-shadow-inset;
-      height:500px;
+      height:490px;
       .CodeMirror-hscrollbar {
         left: 0 !important;
       }
     }
+    .CodeMirror-fullscreen {
+      top: 88px;
+    }
+
     #sgrip {
+      &:hover {
+        color: #111;
+      }
+      i {
+        position: relative;
+        left: 50%;
+      }
+      width: 100%;
+      text-shadow: 0 1px 2px rgba(0,0,0,.6);
       position: absolute;
-      left: 50%;
       cursor: s-resize;
       color: #999999;
+      zndex: 2;
     }
     .table-results {
       .argument {
@@ -371,6 +384,7 @@
       }
     }
     .panel-body {
+      position: relative;
       padding: 5px;
       background-color: #f5f5f5;
       border-bottom: 1px solid #dddddd;
@@ -393,6 +407,19 @@
           padding: 2px 5px 0 0;
         }
       }
+      .fullscreen-toggle {
+        &:hover {
+          color: #111;
+        }
+        cursor: pointer;
+        padding-left: 5px;
+        position: absolute;
+        right: 3px;
+        bottom: -22px;
+        z-index: 78;
+        color: #ddd;
+        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
+      }
     }
     .panel-footer {
       padding: 5px;
@@ -431,6 +458,27 @@
         }
       }
     }
+    &.fullscreen {
+      .panel-heading {
+        position: fixed;
+        top: 0;
+        right: 0px;
+        left: 0;
+        z-index: 77;
+        border-top: 1px solid #ddd;
+        border-right: 1px solid #ddd;
+        border-left: 1px solid #ddd;
+      }
+      .panel-body {
+        position: fixed;
+        top: 55px;
+        right: 0px;
+        left: 0;
+        z-index: 76;
+        border-right: 1px solid #ddd;
+        border-left: 1px solid #ddd;
+      }
+    }
   }
   .params-block {
     .block-title {
@@ -540,28 +588,26 @@
       background-color: #fcfcfc;
     }
   }
-  .CodeMirror {
-    .common-shadow-inset;
-    height: 215px;
-    border-bottom: 1px solid #dddddd;
-    cursor: not-allowed;
-    background-color: #fcfcfc;
-    .CodeMirror-gutters {
-      background-color: #fcfcfc;
-    }
-    .CodeMirror-hscrollbar {
-      left: 0 !important;
-    }
-  }
   #sgrip {
-      position: absolute;
+    &:hover {
+      color: #111;
+    }
+    i {
+      position: relative;
       left: 50%;
-      cursor: s-resize;
-      color: #999999;
     }
-
+    width: 100%;
+    text-shadow: 0 1px 2px rgba(0,0,0,.6);
+    position: absolute;
+    cursor: s-resize;
+    color: #999999;
+    z-index: 2;
+  }
   .arguments-wrap {
     padding: 5px;
+    .alert {
+      padding: 6px 15px;
+    }
     .label {
       padding: 5px;
       display: inline-block;
@@ -572,6 +618,17 @@
 
   #scriptDetails {
     .body-title {
+      &.fullscreen {
+        position: fixed;
+        top: 0;
+        right: 0px;
+        left: 0;
+        z-index: 77;
+        border-top: 1px solid #ddd;
+        border-right: 1px solid #ddd;
+        border-left: 1px solid #ddd;
+      }
+      position: relative;
       padding: 5px;
       background-color: #fcfcfc;
       border-bottom: 1px solid #dddddd;
@@ -581,6 +638,35 @@
       border-radius: 0;
       margin-bottom: 0;
     }
+    .fullscreen-toggle {
+      &:hover {
+        color: #111;
+      }
+      cursor: pointer;
+      padding-left: 5px;
+      position: absolute;
+      right: 3px;
+      bottom: -22px;
+      z-index: 78;
+      color: #ddd;
+      text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
+    }
+    .CodeMirror {
+      .common-shadow-inset;
+      height: 215px;
+      border-bottom: 1px solid #dddddd;
+      cursor: not-allowed;
+      background-color: #fcfcfc;
+      .CodeMirror-gutters {
+        background-color: #fcfcfc;
+      }
+      .CodeMirror-hscrollbar {
+        left: 0 !important;
+      }
+    }
+    .CodeMirror-fullscreen {
+      top: 30px;
+    }
   }
 
   .job-info {
@@ -762,3 +848,14 @@ opacity: 0.89;
     margin-top: 0;
   }
 }
+
+.CodeMirror-fullscreen {
+  z-index: 75;
+  border-bottom: 1px solid #ddd;
+  border-right: 1px solid #ddd;
+  border-left: 1px solid #ddd;
+}
+
+.CodeMirror-hints {
+  z-index: 78;
+}

+ 6 - 6
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createScript.hbs

@@ -16,18 +16,18 @@
    limitations under the License.
 }}
 
-{{#pig-modal ok='confirm' close='cancel' escape-press='cancel'}}
+{{#pig-modal ok='confirm' close='cancel'}}
   <div class="modal-header">
     <button type="button" class="close" {{action "cancel" target="view"}} aria-hidden="true">&times;</button>
     <h4 class="modal-title">{{t 'scripts.modal.create_script'}}</h4>
   </div>
   <div class="modal-body">
-  <div class="form-group">
+  <div {{bind-attr class=":form-group titleErrorMessage:has-error"}}>
       <label>{{t 'scripts.title'}}</label>
-      {{input class="form-control" placeholderTranslation="scripts.modal.script_title_placeholder" valueBinding="content.title"}}
+      {{input class="form-control" placeholderTranslation="scripts.modal.script_title_placeholder" valueBinding="content.title" change=titleChange}}
     </div>
-    {{#if titleError}}
-      <div class="alert alert-danger">{{titleError}}</div>
+    {{#if content.isBlankTitle}}
+      <div  {{bind-attr class=":alert :alert-danger titleErrorMessage::hide"}}>{{titleErrorMessage}}</div>
     {{/if}}
     <div class="form-group">
       <label for="exampleInputPassword1">{{t 'scripts.path'}}</label>
@@ -37,6 +37,6 @@
   </div>
   <div class="modal-footer">
     <button type="button" {{action "cancel" target="view"}} class="btn btn-default" >{{t 'common.cancel'}}</button>
-    <button type="button" {{action "ok" target="view"}} {{bind-attr class="titleError:disabled :btn :btn-success"}} >{{t 'common.create'}}</button>
+    <button type="button" {{action "ok" target="view"}} {{bind-attr class="content.isBlankTitle:disabled :btn :btn-success"}} >{{t 'common.create'}}</button>
   </div>
 {{/pig-modal}}

+ 2 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createUdf.hbs

@@ -32,7 +32,7 @@
     </div>
   </div>
   <div class="modal-footer">
-    <button type="button" {{action "cancel" content target="view"}} class="btn btn-default" >{{t 'common.cancel'}}</button>
-    <button type="button" {{action "ok" target="view"}} {{bind-attr class=":btn :btn-success udfInvalid:disabled"}}>{{t 'common.create'}}</button>
+    <button type="button" {{action "cancel" content target="view"}} class="btn btn-default">{{t 'common.cancel'}}</button>
+    <button type="button" {{action "ok" target="view"}} {{bind-attr class=":btn :btn-success isValid::disabled"}}>{{t 'common.create'}}</button>
   </div>
 {{/pig-modal}}

+ 31 - 0
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteUdf.hbs

@@ -0,0 +1,31 @@
+{{!
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+}}
+
+{{#pig-modal ok='confirm'}}
+  <div class="modal-header">
+    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">{{t 'scripts.modal.confirm_delete'}}</h4>
+  </div>
+  <div class="modal-body">
+  {{t 'udfs.modal.delete_udf' titleBinding="content.name" tagName="p"}}
+  </div>
+  <div class="modal-footer">
+    <button type="button" {{action "cancel" target="view"}} class="btn btn-default" data-dismiss="modal">{{t 'common.cancel'}}</button>
+    <button type="button" {{action "ok" content target="view"}} class="btn btn-danger">{{t 'common.delete'}}</button>
+  </div>
+{{/pig-modal}}

+ 7 - 7
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig.hbs

@@ -25,22 +25,22 @@
         <div class="nav-script-wrap">
           <div class=" nav-script" >
             <div>
-              <button type="button" class="close_script" {{action closeScript}}>
+              <button type="button" class="close_script" tabindex="-1" {{action closeScript}}>
                 <i class="fa fa-times"></i>
               </button>
             </div>
             <div class="script-title">
-              {{#if activeScript.label}}
-                <span>{{activeScript.label}}</span>
+              {{#unless activeScript.isBlankTitle}}
+                <span>{{activeScript.title}}</span>
                 {{else}}
                 <span>...</span>
-              {{/if}}
+              {{/unless}}
             </div>
            <ul class="script-actions list-unstyled">
-              <li><a href="#" {{action "saveScript" activeScript}} {{bind-attr class=":btn :btn-block saveEnabled::disabled"}} ><i class="fa fa-fw fa-save"></i> {{t 'common.save'}}</a></li>
-              <li><a href="#" {{action "copyScript" activeScript}} {{bind-attr class=":btn :btn-block disableScriptControls:disabled"}} ><i class="fa fa-fw fa-copy"></i> {{t 'common.copy'}}</a></li>
+              <li><a href="#" tabindex="-1" {{action "saveScript" activeScript}} {{bind-attr class=":btn :btn-block saveEnabled::disabled"}} ><i class="fa fa-fw fa-save"></i> {{t 'common.save'}}</a></li>
+              <li><a href="#" tabindex="-1" {{action "copyScript" activeScript}} {{bind-attr class=":btn :btn-block disableScriptControls:disabled"}} ><i class="fa fa-fw fa-copy"></i> {{t 'common.copy'}}</a></li>
               <li class="divider"></li>
-              <li><a href="#" {{action "deletescript" activeScript}} {{bind-attr class=":btn :btn-block disableScriptControls:disabled"}}  ><i class="fa fa-fw fa-trash-o"></i> {{t 'common.delete'}}</a></li>
+              <li><a href="#" tabindex="-1" {{action "deletescript" activeScript}} {{bind-attr class=":btn :btn-block disableScriptControls:disabled"}}  ><i class="fa fa-fw fa-trash-o"></i> {{t 'common.delete'}}</a></li>
             </ul>
           </div>
         </div>

+ 1 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/udfs.hbs

@@ -36,7 +36,7 @@
           <td> {{this.name}}</td>
           <td> {{this.path}}</td>
           <td> {{this.owner}}</td>
-          <td><a href="#" {{action "deleteUdf" this}} ><i class="fa fa-trash-o"></i> {{t 'common.delete'}}</a></td>
+          <td><a href="#" {{action "deleteUdfModal" this}} ><i class="fa fa-trash-o"></i> {{t 'common.delete'}}</a></td>
         </tr>
     {{/each}}
     </tbody>

+ 11 - 7
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/edit.hbs

@@ -17,9 +17,11 @@
 }}
 
 <div class="edit-script">
-  <div {{bind-attr class=":panel :panel-editscript scriptError:panel-danger:panel-default"}} >
+  <div {{bind-attr class=":panel :panel-editscript fullscreen:fullscreen scriptError:panel-danger:panel-default"}} >
     <div class="panel-heading">
       {{outlet nav}}
+
+      {{!-- Button --}}
       {{#unless isExec}}
         <div {{bind-attr class=":btn-group :pull-right isRenaming:hide"}}>
           <button {{action "execute" content 'execute' }} type="button" class="btn btn-primary">{{t 'editor.execute'}}</button>
@@ -36,19 +38,20 @@
         {{else}}
         <div class="spinner-sm pull-right"></div>
       {{/unless}}
-      {{#unless isRenaming}}
 
+      {{!-- Title --}}
+      {{#unless isRenaming}}
         <div class="script-title">
           <h4> {{content.title}} <a href="#" {{action 'rename' 'ask'}} class="btn-rename"><i class="fa fa-pencil"></i></a></h4>
         </div>
-
       {{else}}
         <div  {{bind-attr class=":input-group :input-title titleWarn:has-error"}}>
-          {{input
+          {{view view.focusInput
             id="title"
             placeholderTranslation="scripts.modal.script_title_placeholder"
             class="form-control"
             valueBinding="content.title"
+            action='rename'
           }}
           <div class="input-group-btn">
             <button  type="button" {{action 'rename' 'cancel'}} {{bind-attr class=":btn :btn-default :btn-rename-cancel"}} >
@@ -56,7 +59,7 @@
             </button>
           </div>
           <div class="input-group-btn">
-            <button  type="button" {{action 'rename' 'confirm'}} {{bind-attr class=":btn :btn-success :btn-rename-confirm content.title::disabled"}} >
+            <button  type="button" {{action 'rename' content.title}} {{bind-attr class=":btn :btn-success :btn-rename-confirm content.isBlankTitle:disabled"}} >
               <i class="fa fa-lg fa-check"></i> <span class="hidden-xs">{{t 'editor.save'}}</span>
             </button>
           </div>
@@ -79,7 +82,8 @@
           </ul>
         </div>
       </div>
-      <kbd class="file-path pull-right" data-toggle="tooltip" data-placement="bottom"{{translateAttr title="udfs.tooltips.path"}} >
+      <div class="fullscreen-toggle pull-right" {{action 'fullscreen'}} data-toggle="tooltip" data-placement="bottom"  {{translateAttr title="editor.toggle_fullscreen"}}><i {{bind-attr class=":fa :fa-lg fullscreen:fa-compress:fa-expand"}} ></i></div>
+      <kbd class="file-path pull-right" data-toggle="tooltip" data-placement="bottom" {{translateAttr title="udfs.tooltips.path"}} >
         {{#unless content.pigScript.isLoaded}}
           <div class="spinner-sm"></div>
         {{else}}
@@ -88,7 +92,7 @@
       </kbd>
     </div>
     <div class="editor-container">
-      {{code-mirror id="pig_script" content=content.pigScript codeMirror=editor}}
+      {{code-mirror id="pig_script" content=content.pigScript codeMirror=editor fullscreen=fullscreen}}
       <div class="ui-resizable-handle ui-resizable-s" id="sgrip"><i class="fa fa-ellipsis-h"></i></div>
     </div>
   </div>

+ 12 - 5
contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs

@@ -118,8 +118,9 @@
         </h4>
       </div>
       {{#view "view.collapsePanel" id="scriptDetails" class="panel-collapse collapse" }}
-        <div class="panel-body body-title">
+        <div {{bind-attr class=":panel-body :body-title :body-title-contents fullscreen:fullscreen "}} >
           {{t 'job.script_contents'}}:
+          <div class="fullscreen-toggle pull-right" {{action 'fullscreen'}} data-toggle="tooltip" data-placement="bottom" {{translateAttr title="editor.toggle_fullscreen"}}><i {{bind-attr class=":fa :fa-lg fullscreen:fa-compress:fa-expand"}} ></i></div>
         </div>
           {{#if scriptContents.isPending}}
             <div class="panel-body">
@@ -128,7 +129,7 @@
           {{else}}
             {{#if scriptContents.isFulfilled}}
               <div class="editor-container">
-                {{code-mirror id="pig_script" content=scriptContents readOnly=true}}
+                {{code-mirror id="pig_script" content=scriptContents readOnly=true fullscreen=fullscreen}}
                 <div class="ui-resizable-handle ui-resizable-s" id="sgrip"><i class="fa fa-ellipsis-h"></i></div>
               </div>
             {{else}}
@@ -143,9 +144,15 @@
           {{t 'common.arguments'}}:
         </div>
         <div class="panel-body arguments-wrap">
-          {{#each argumentsArray}}
-            <span class="label label-primary">{{this}}</span>
-          {{/each}}
+          {{#if argumentsArray}}
+            {{#each argumentsArray}}
+              <span class="label label-primary">{{this}}</span>
+            {{/each}}
+          {{else}}
+            <div class="alert alert-info" role="alert">
+              {{t 'job.no_arguments_message'}}
+            </div>
+          {{/if}}
         </div>
       {{/view}}
     </div>

+ 5 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js

@@ -97,7 +97,8 @@ Ember.I18n.translations = {
     'no_arguments_message':'This pig script has no arguments defined.',
     'execute':'Execute',
     'explain':'Explain',
-    'syntax_check':'Syntax check'
+    'syntax_check':'Syntax check',
+    'toggle_fullscreen':'Toggle fullscreen (F11)'
   },
   'job':{
     'title': "Title",
@@ -112,6 +113,7 @@ Ember.I18n.translations = {
     'kill_job': "Kill Job",
     'script_details': "Script Details",
     'script_contents': "Script contents",
+    'no_arguments_message':'This job was executed without arguments.',
     'alert':{
       'job_started' :'Job started!',
       'job_killed' :'{{title}} job killed',
@@ -153,7 +155,8 @@ Ember.I18n.translations = {
     'modal':{
       'create_udf':'Create UDF',
       'udf_name':'UDF name',
-      'hdfs_path':'/hdfs/path/to/udf'
+      'hdfs_path':'/hdfs/path/to/udf',
+      'delete_udf':'Are you sure you want to delete {{title}} udf?'
     }
   },
   'history':{

+ 2 - 2
contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/history.js

@@ -21,11 +21,11 @@ var App = require('app');
 App.PigHistoryView = Em.View.extend({
   initTooltips:function () {
     if ( this.$('td:last-child a')) {
-      Em.run.next(this.addTooltip.bind(this))
+      Em.run.next(this.addTooltip.bind(this));
     }
   }.on('didInsertElement').observes('controller.page','controller.content.@each'),
   addTooltip:function () {
-    this.$('td:last-child a').tooltip({placement:'bottom'})
+    this.$('td:last-child a').tooltip({placement:'bottom'});
   },
   scriptLink:Em.Component.extend({
     tagName:'a',

+ 12 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/edit.js

@@ -20,7 +20,10 @@ var App = require('app');
 
 App.ScriptEditView = Em.View.extend({
   didInsertElement:function () {
-    $('.file-path').tooltip();
+    $('.file-path, .fullscreen-toggle').tooltip();
+  },
+  willClearRender:function () {
+    this.set("controller.fullscreen", false);
   },
   showTitleWarn:function () {
     if (this.get('controller.titleWarn')) {
@@ -52,5 +55,13 @@ App.ScriptEditView = Em.View.extend({
         this.send('sendArgument');
       }
     }
+  }),
+  focusInput:Em.TextField.extend({
+    becomeFocused: function () {
+      this.$().focus().val(this.$().val());
+    }.on('didInsertElement'),
+    cancel:function (argument) {
+      this.sendAction('action','cancel');
+    }
   })
 });

+ 13 - 1
contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/job.js

@@ -27,9 +27,21 @@ App.ScriptJobView = Em.View.extend({
       this.$().on('show.bs.collapse', function (e) {
         this.$().parent().find('.toggle-icon').addClass('fa-rotate-90');
       }.bind(this));
+      //fix for CodeMirror not rendered properly in hidden container
+      if (this.get('elementId') === "scriptDetails") {
+        this.$().on('shown.bs.collapse', function (e) {
+          var cme = this.$('.CodeMirror').get(0);
+          if (cme && cme.CodeMirror) {
+            cme.CodeMirror.setSize(null, this.$('.editor-container').height());
+          }
+        }.bind(this));
+      }
     }.on('didInsertElement'),
     unbindToggle:function () {
       this.$().off('hide.bs.collapse','show.bs.collapse');
     }.on('willClearRender')
-  })
+  }),
+  bindTooltips:function () {
+    $('.fullscreen-toggle').tooltip();
+  }.on('didInsertElement')
 });

+ 12 - 0
contrib/views/pig/src/main/resources/ui/pig-web/bower.json

@@ -14,6 +14,18 @@
     "file-saver": "*"
   },
   "overrides": {
+    "codemirror":{
+      "main" : [
+        "lib/codemirror.js",
+        "lib/codemirror.css",
+        "mode/pig/pig.js",
+        "addon/hint/show-hint.css",
+        "addon/hint/show-hint.js",
+        "addon/display/fullscreen.js",
+        "addon/display/fullscreen.css",
+        "addon/hint/anyword-hint.js"
+      ]
+    },
     "bootstrap": {
       "main": [
         "./dist/js/bootstrap.js"

+ 3 - 1
contrib/views/pig/src/main/resources/ui/pig-web/config.coffee

@@ -26,9 +26,11 @@ exports.config =
       defaultExtension: 'js'
       joinTo: 
         'static/javascripts/app.js': /^app/
-        'static/javascripts/vendor.js': /^bower_components|vendor/
+        'static/javascripts/vendor.js': /^bower_components|vendor/,
+        'static/javascripts/test.js': /^test(\/|\\)(?!vendor)/
       order:
         before: [
+          'bower_components/moment/moment.js',
           'bower_components/jquery/dist/jquery.js',
           'vendor/jquery-ui/core.js',
           'vendor/jquery-ui/widget.js',

+ 7 - 0
contrib/views/pig/src/main/resources/ui/pig-web/package.json

@@ -5,6 +5,7 @@
     "node": "~0.6.10 || 0.8 || 0.9"
   },
   "scripts": {
+    "test": "node_modules/phantomjs/bin/phantomjs runner.js public/tests.html",
     "start": "brunch watch --server",
     "preinstall": "chmod +x node/npm/bin/node-gyp-bin/node-gyp",
     "postinstall" : "bash node/with_new_path.sh node node_modules/.bin/bower --allow-root install"
@@ -18,5 +19,11 @@
     "ember-precompiler-brunch": ">= 1.5.0",
     "less-brunch": "~1.7.1",
     "scaffolt": "^0.4.3"
+  },
+  "devDependencies": {
+    "phantomjs": "^1.9.2",
+    "karma": "*",
+    "karma-qunit": "*",
+    "karma-phantomjs-launcher": "~0.1.2"
   }
 }

+ 136 - 0
contrib/views/pig/src/main/resources/ui/pig-web/runner.js

@@ -0,0 +1,136 @@
+/*
+ * PhantomJS Runner QUnit Plugin (List Tests) 1.2.0
+ *
+ * PhantomJS binaries: http://phantomjs.org/download.html
+ * Requires PhantomJS 1.6+ (1.7+ recommended)
+ *
+ * Run with:
+ *   phantomjs runner-list.js [url-of-your-qunit-testsuite]
+ *
+ * e.g.
+ *   phantomjs runner-list.js http://localhost/qunit/test/index.html
+ */
+
+/*global phantom:false, require:false, console:false, window:false, QUnit:false */
+
+(function() {
+  'use strict';
+
+  var url, page, timeout,
+    args = require('system').args;
+
+  // arg[0]: scriptName, args[1...]: arguments
+  if (args.length < 2 || args.length > 3) {
+    console.error('Usage:\n  phantomjs runner-list.js [url-of-your-qunit-testsuite] [timeout-in-seconds]');
+    phantom.exit(1);
+  }
+
+  url = args[1];
+  page = require('webpage').create();
+  if (args[2] !== undefined) {
+    timeout = parseInt(args[2], 10);
+  }
+
+  // Route `console.log()` calls from within the Page context to the main Phantom context (i.e. current `this`)
+  page.onConsoleMessage = function(msg) {
+    console.log(msg);
+  };
+
+  page.onInitialized = function() {
+    page.evaluate(addLogging);
+  };
+
+  page.onCallback = function(message) {
+    var result,
+      failed;
+
+    if (message) {
+      if (message.name === 'QUnit.done') {
+        result = message.data;
+        failed = !result || !result.total || result.failed;
+
+        if (!result.total) {
+          console.error('No tests were executed. Are you loading tests asynchronously?');
+        }
+
+        phantom.exit(failed ? 1 : 0);
+      }
+    }
+  };
+
+  page.open(url, function(status) {
+    if (status !== 'success') {
+      console.error('Unable to access network: ' + status);
+      phantom.exit(1);
+    } else {
+      // Cannot do this verification with the 'DOMContentLoaded' handler because it
+      // will be too late to attach it if a page does not have any script tags.
+      var qunitMissing = page.evaluate(function() { return (typeof QUnit === 'undefined' || !QUnit); });
+      if (qunitMissing) {
+        console.error('The `QUnit` object is not present on this page.');
+        phantom.exit(1);
+      }
+
+      // Set a timeout on the test running, otherwise tests with async problems will hang forever
+      if (typeof timeout === 'number') {
+        setTimeout(function() {
+          console.error('The specified timeout of ' + timeout + ' seconds has expired. Aborting...');
+          phantom.exit(1);
+        }, timeout * 1000);
+      }
+
+      // Do nothing... the callback mechanism will handle everything!
+    }
+  });
+
+  function addLogging() {
+    window.document.addEventListener('DOMContentLoaded', function() {
+      var currentTestAssertions = [];
+
+      QUnit.log(function(details) {
+        var response;
+
+        console.log((details.result ? "? ": "? ") + details.message);
+
+        if (!details.result) {
+          response = details.message || '';
+
+          if (typeof details.expected !== 'undefined') {
+            if (response) {
+              response += ', ';
+            }
+
+            response += 'expected: ' + details.expected + ', but was: ' + details.actual;
+          }
+
+          if (details.source) {
+            response += '\n' + details.source;
+          }
+
+          console.log('    Failed assertion: ' + response);
+        }
+      });
+
+      QUnit.moduleStart(function( details ) {
+        if (details.name) {
+          console.log('\n' + details.name);
+        }
+      });
+
+      QUnit.testStart(function(result) {
+        console.log('\n' + result.name);
+      });
+
+      QUnit.done(function(result) {
+        console.log('\n' + 'Took ' + result.runtime +  'ms to run ' + result.total + ' tests. ' + result.passed + ' passed, ' + result.failed + ' failed.');
+
+        if (typeof window.callPhantom === 'function') {
+          window.callPhantom({
+            'name': 'QUnit.done',
+            'data': result
+          });
+        }
+      });
+    }, false);
+  }
+})();

+ 0 - 17
contrib/views/pig/src/main/resources/ui/pig-web/test/spec.coffee

@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Write your [mocha](http://visionmedia.github.com/mocha/) specs here.

+ 37 - 0
contrib/views/pig/src/main/resources/ui/pig-web/test/unit/controllers/pig_test.js

@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+moduleFor('controller:pig', 'App.PigController', {
+  needs:['controller:scriptEdit','controller:script'],
+});
+
+test('Can get active Script after active Script Id script is set', function () {
+
+  var pig = this.subject();
+
+  var script = Ember.Object.create({ title: 'script_1', id:'1' });
+
+  Ember.run(function() {
+
+    pig.set('model', [script]);
+    pig.set('activeScriptId', '1');
+
+    deepEqual(script, pig.get('activeScript'), 'script is set');
+  });
+});

+ 110 - 0
contrib/views/pig/src/main/resources/ui/pig-web/vendor/pig-hint.js

@@ -0,0 +1,110 @@
+(function () {
+
+  var pigKeywordsU = pigKeywordsL = pigTypesU = pigTypesL = pigBuiltinsU = pigBuiltinsL = [];
+
+  var mimeMode = CodeMirror.mimeModes['text/x-pig'];
+
+  Object.keys(mimeMode.keywords).forEach( function(w) {
+    pigKeywordsU.push(w.toUpperCase());
+    pigKeywordsL.push(w.toLowerCase());
+  });
+
+  Object.keys(mimeMode.types).forEach( function(w) {
+    pigTypesU.push(w.toUpperCase());
+    pigTypesL.push(w.toLowerCase());
+  });
+
+  Object.keys(mimeMode.builtins).forEach( function(w) {
+    pigBuiltinsU.push(w.toUpperCase());
+    pigBuiltinsL.push(w.toLowerCase());
+  });
+
+  function forEach(arr, f) {
+    for (var i = 0, e = arr.length; i < e; ++i) {
+      f(arr[i]);
+    }
+  }
+
+  function arrayContains(arr, item) {
+    if (!Array.prototype.indexOf) {
+      var i = arr.length;
+      while (i--) {
+        if (arr[i] === item) {
+          return true;
+        }
+      }
+      return false;
+    }
+    return arr.indexOf(item) != -1;
+  }
+
+  function scriptHint(editor, keywords, getToken) {
+    // Find the token at the cursor
+    var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
+    // If it's not a 'word-style' token, ignore the token.
+
+    if (!/^[\w$_]*$/.test(token.string)) {
+        token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
+                         type: token.string == ":" ? "pig-type" : null};
+    }
+
+    if (!context) var context = [];
+    context.push(tprop);
+
+    completionList = getCompletions(token, context);
+    completionList = completionList.sort();
+
+    return {list: completionList,
+              from: {line: cur.line, ch: token.start},
+              to: {line: cur.line, ch: token.end}};
+  }
+
+  function toTitleCase(str) {
+     return str.replace(/(?:^|\s)\w/g, function(match) {
+         return match.toUpperCase();
+     });
+  }
+
+
+  function getCompletions(token, context) {
+    var found = [], start = token.string;
+    function maybeAdd(str) {
+      if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
+    }
+
+    function gatherCompletions(obj) {
+      if(obj == ":") {
+        forEach(pigTypesL, maybeAdd);
+      }
+      else {
+        forEach(pigBuiltinsU, maybeAdd);
+        forEach(pigBuiltinsL, maybeAdd);
+        forEach(pigTypesU, maybeAdd);
+        forEach(pigTypesL, maybeAdd);
+        forEach(pigKeywordsU, maybeAdd);
+        forEach(pigKeywordsL, maybeAdd);
+      }
+    }
+
+    if (context) {
+      // If this is a property, see if it belongs to some object we can
+      // find in the current environment.
+      var obj = context.pop(), base;
+
+      if (obj.type == "pig-word")
+          base = obj.string;
+      else if(obj.type == "pig-type")
+          base = ":" + obj.string;
+
+      while (base != null && context.length)
+        base = base[context.pop().string];
+      if (base != null) gatherCompletions(base);
+    }
+    return found;
+  }
+
+  CodeMirror.registerHelper("hint", "pig", function(cm, options) {
+    return scriptHint(cm, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
+  });
+
+})();

+ 3 - 0
pom.xml

@@ -234,6 +234,9 @@
             <exclude>contrib/views/pig/src/main/resources/ui/pig-web/node/**</exclude>
             <exclude>contrib/views/pig/src/main/resources/ui/pig-web/bower_components/**</exclude>
             <exclude>contrib/views/pig/src/main/resources/ui/pig-web/vendor/**</exclude>
+            <exclude>contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/stylesheets/**</exclude>
+            <exclude>contrib/views/pig/src/main/resources/ui/pig-web/app/assets/static/javascripts/**</exclude>
+            <exclude>contrib/views/pig/src/main/resources/ui/pig-web/runner.js</exclude>
             <exclude>contrib/views/slider/src/main/resources/ui/public/**</exclude>
             <exclude>contrib/views/slider/src/main/resources/ui/node_modules/**</exclude>
             <exclude>contrib/views/slider/src/main/resources/ui/vendor/**</exclude>

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.