Commit 2f9b088a authored by Thibaut Frain's avatar Thibaut Frain

renderjs 0.3.2 update

parent a6373f47
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<!-- Jquery --> <!-- Jquery -->
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<!-- renderjs --> <!-- renderjs -->
<script src="../lib/rsvp.js" type="text/javascript"></script>
<script src="../lib/jschannel.js" type="text/javascript"></script> <script src="../lib/jschannel.js" type="text/javascript"></script>
<script src="../lib/renderjs.js" type="text/javascript"></script> <script src="../lib/renderjs.js" type="text/javascript"></script>
</head> </head>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<script src="../lib/jquery.hotkeys.js"></script> <script src="../lib/jquery.hotkeys.js"></script>
<script src="../lib/bootstrap.min.js"></script> <script src="../lib/bootstrap.min.js"></script>
<script src="../lib/bootstrap-wysiwyg.js"></script> <script src="../lib/bootstrap-wysiwyg.js"></script>
<script src="../lib/rsvp.js"></script>
<script src="../lib/jschannel.js"></script> <script src="../lib/jschannel.js"></script>
<script src="../lib/renderjs.js"></script> <script src="../lib/renderjs.js"></script>
<script src="../js/gadget_bootstrap_wysiwyg.js"></script> <script src="../js/gadget_bootstrap_wysiwyg.js"></script>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<link rel="stylesheet" href="../css/codemirror.css"> <link rel="stylesheet" href="../css/codemirror.css">
<script src="../lib/jquery.js"></script> <script src="../lib/jquery.js"></script>
<script src="../lib/rsvp.js"></script>
<script src="../lib/jschannel.js"></script> <script src="../lib/jschannel.js"></script>
<script src="../lib/renderjs.js"></script> <script src="../lib/renderjs.js"></script>
<script src="../lib/codemirror/codemirror.js"></script> <script src="../lib/codemirror/codemirror.js"></script>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<!-- Jquery --> <!-- Jquery -->
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<!-- renderjs --> <!-- renderjs -->
<script src="../lib/rsvp.js" type="text/javascript"></script>
<script src="../lib/jschannel.js" type="text/javascript"></script> <script src="../lib/jschannel.js" type="text/javascript"></script>
<script src="../lib/renderjs.js" type="text/javascript"></script> <script src="../lib/renderjs.js" type="text/javascript"></script>
</head> </head>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<!-- Jquery --> <!-- Jquery -->
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<!-- renderjs --> <!-- renderjs -->
<script src="../lib/rsvp.js" type="text/javascript"></script>
<script src="../lib/jschannel.js" type="text/javascript"></script> <script src="../lib/jschannel.js" type="text/javascript"></script>
<script src="../lib/renderjs.js" type="text/javascript"></script> <script src="../lib/renderjs.js" type="text/javascript"></script>
</head> </head>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<script src="../lib/jquery.mobile.js" type="text/javascript"></script> <script src="../lib/jquery.mobile.js" type="text/javascript"></script>
<script src="../lib/extensions.js" type="text/javascript"></script> <script src="../lib/extensions.js" type="text/javascript"></script>
<!-- renderjs --> <!-- renderjs -->
<script src="../lib/rsvp.js" type="text/javascript"></script>
<script src="../lib/jschannel.js" type="text/javascript"></script> <script src="../lib/jschannel.js" type="text/javascript"></script>
<script src="../lib/renderjs.js" type="text/javascript"></script> <script src="../lib/renderjs.js" type="text/javascript"></script>
<!-- route --> <!-- route -->
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<!-- Jquery --> <!-- Jquery -->
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<!-- renderjs --> <!-- renderjs -->
<script src="../lib/rsvp.js" type="text/javascript"></script>
<script src="../lib/jschannel.js" type="text/javascript"></script> <script src="../lib/jschannel.js" type="text/javascript"></script>
<script src="../lib/renderjs.js" type="text/javascript"></script> <script src="../lib/renderjs.js" type="text/javascript"></script>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<script src="../lib/jquery.sheet-2.0.0/jquery-1.5.2.min.js"></script> <script src="../lib/jquery.sheet-2.0.0/jquery-1.5.2.min.js"></script>
<script src="../lib/jschannel.js"></script> <script src="../lib/jschannel.js"></script>
<script src="../lib/rsvp.js"></script>
<script src="../lib/renderjs.js"></script> <script src="../lib/renderjs.js"></script>
<script src="../lib/jquery.sheet-2.0.0/jquery.sheet.min.js"></script> <script src="../lib/jquery.sheet-2.0.0/jquery.sheet.min.js"></script>
<script src="../lib/jquery.sheet-2.0.0/parser.js"></script> <script src="../lib/jquery.sheet-2.0.0/parser.js"></script>
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
</head> </head>
<body> <body>
<div class="jQuerySheet"></div> <div id="jQuerySheet"></div>
</body> </body>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<!-- Jquery --> <!-- Jquery -->
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<!-- renderjs --> <!-- renderjs -->
<script src="../lib/rsvp.js" type="text/javascript"></script>
<script src="../lib/jschannel.js" type="text/javascript"></script> <script src="../lib/jschannel.js" type="text/javascript"></script>
<script src="../lib/renderjs.js" type="text/javascript"></script> <script src="../lib/renderjs.js" type="text/javascript"></script>
<!-- custom script --> <!-- custom script -->
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
rJS(this).editor.html(''); rJS(this).editor.html('');
}) })
.ready(function () { .ready(function (g) {
init.apply(rJS(this)); init.apply(g);
}); });
}(window, jQuery, rJS)); }(window, jQuery, rJS));
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
return rJS(this).cmInstance; return rJS(this).cmInstance;
}) })
.ready(function () { .ready(function (g) {
var textarea = $("textarea#codemirror")[0]; var textarea = $("textarea#codemirror")[0];
rJS(this).cmInstance = CodeMirror.fromTextArea(textarea); g.cmInstance = CodeMirror.fromTextArea(textarea);
}); });
}(window, jQuery, rJS, CodeMirror)); }(window, jQuery, rJS, CodeMirror));
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
(function (window, $, rJS) { (function (window, $, rJS) {
function init(config) { function init(config) {
this.parent = this.context.find('.jQuerySheet'); this.parent = $(window.document.getElementById('jQuerySheet'));
this.parent.sheet(config); this.parent.sheet(config);
this.instance = this.parent.getSheet(); this.instance = this.parent.getSheet();
} }
...@@ -49,8 +49,9 @@ ...@@ -49,8 +49,9 @@
init.apply(rJS(this), [default_config]); init.apply(rJS(this), [default_config]);
}) })
.ready(function () { .ready(function (g) {
init.apply(rJS(this), [default_config]); console.log('truc');
init.apply(g, [default_config]);
}); });
}(window, jQuery, rJS)); }(window, jQuery, rJS));
This diff is collapsed.
!function(){var a,b;!function(){var c={},d={};a=function(a,b,d){c[a]={deps:b,callback:d}},b=function(a){if(d[a])return d[a];d[a]={};var e=c[a];if(!e)throw new Error("Module '"+a+"' not found.");for(var f,g=e.deps,h=e.callback,i=[],j=0,k=g.length;k>j;j++)"exports"===g[j]?i.push(f={}):i.push(b(g[j]));var l=h.apply(this,i);return d[a]=f||l}}(),a("rsvp/all",["rsvp/promise","exports"],function(a,b){"use strict";function c(a,b){function c(){for(var a,c=0;c<b.length;c++)a=b[c],a&&"function"==typeof a.then&&"function"==typeof a.cancel&&a.cancel()}if("[object Array]"!==Object.prototype.toString.call(b))throw new TypeError("You must pass an array to all.");return new f(function(d,e,f){function g(a){return function(b){h(a,b)}}function h(a,b){l[a]=b,--m===n&&(0===n?d(l):(d(b),c()))}function i(a){return function(b){f({index:a,value:b})}}function j(a){e(a),c()}var k,l=[],m=b.length,n=b.length-a;0===m&&(1===a?d():d([]));for(var o=0;o<b.length;o++)k=b[o],k&&"function"==typeof k.then?k.then(g(o),j,i(o)):h(o,k)},c)}function d(a){return c(a.length,a)}function e(a){return c(1,a)}var f=a.Promise;b.all=d,b.any=e}),a("rsvp/async",["exports"],function(a){"use strict";function b(){return function(a,b){process.nextTick(function(){a(b)})}}function c(){return function(a,b){setImmediate(function(){a(b)})}}function d(){var a=[],b=new h(function(){var b=a.slice();a=[],b.forEach(function(a){var b=a[0],c=a[1];b(c)})}),c=document.createElement("div");return b.observe(c,{attributes:!0}),window.addEventListener("unload",function(){b.disconnect(),b=null},!1),function(b,d){a.push([b,d]),c.setAttribute("drainQueue","drainQueue")}}function e(){return function(a,b){i.setTimeout(function(){a(b)},1)}}var f,g="undefined"!=typeof window?window:{},h=g.MutationObserver||g.WebKitMutationObserver,i="undefined"!=typeof global?global:this;f="function"==typeof setImmediate?c():"undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?b():h?d():e(),a.async=f}),a("rsvp/cancellation_error",["exports"],function(a){"use strict";function b(a){if(this.name="cancel",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}b.prototype=new Error,b.prototype.constructor=b,a.CancellationError=b}),a("rsvp/config",["rsvp/async","exports"],function(a,b){"use strict";var c=a.async,d={};d.async=c,b.config=d}),a("rsvp/defer",["rsvp/promise","exports"],function(a,b){"use strict";function c(){var a={resolve:void 0,reject:void 0,promise:void 0};return a.promise=new d(function(b,c){a.resolve=b,a.reject=c}),a}var d=a.Promise;b.defer=c}),a("rsvp/events",["exports"],function(a){"use strict";var b=function(a,b){this.type=a;for(var c in b)b.hasOwnProperty(c)&&(this[c]=b[c])},c=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c][0]===b)return c;return-1},d=function(a){var b=a._promiseCallbacks;return b||(b=a._promiseCallbacks={}),b},e={mixin:function(a){return a.on=this.on,a.off=this.off,a.trigger=this.trigger,a},on:function(a,b,e){var f,g,h=d(this);for(a=a.split(/\s+/),e=e||this;g=a.shift();)f=h[g],f||(f=h[g]=[]),-1===c(f,b)&&f.push([b,e])},off:function(a,b){var e,f,g,h=d(this);for(a=a.split(/\s+/);f=a.shift();)b?(e=h[f],g=c(e,b),-1!==g&&e.splice(g,1)):h[f]=[]},trigger:function(a,c){var e,f,g,h,i,j=d(this);if(e=j[a])for(var k=0;k<e.length;k++)f=e[k],g=f[0],h=f[1],"object"!=typeof c&&(c={detail:c}),i=new b(a,c),g.call(h,i)}};a.EventTarget=e}),a("rsvp/hash",["rsvp/defer","exports"],function(a,b){"use strict";function c(a){var b=0;for(var c in a)b++;return b}function d(a){var b={},d=e(),f=c(a);0===f&&d.resolve({});var g=function(a){return function(b){h(a,b)}},h=function(a,c){b[a]=c,0===--f&&d.resolve(b)},i=function(a){d.reject(a)};for(var j in a)a[j]&&"function"==typeof a[j].then?a[j].then(g(j),i):h(j,a[j]);return d.promise}var e=a.defer;b.hash=d}),a("rsvp/node",["rsvp/promise","rsvp/all","exports"],function(a,b,c){"use strict";function d(a,b){return function(c,d){c?b(c):arguments.length>2?a(Array.prototype.slice.call(arguments,1)):a(d)}}function e(a){return function(){var b,c,e=Array.prototype.slice.call(arguments),h=this,i=new f(function(a,d){b=a,c=d});return g(e).then(function(e){e.push(d(b,c));try{a.apply(h,e)}catch(f){c(f)}}),i}}var f=a.Promise,g=b.all;c.denodeify=e}),a("rsvp/promise",["rsvp/config","rsvp/events","rsvp/cancellation_error","exports"],function(a,b,c,d){"use strict";function e(a){return f(a)||"object"==typeof a&&null!==a}function f(a){return"function"==typeof a}function g(a){m.onerror&&m.onerror(a.detail)}function h(a,b){a===b?j(a,b):i(a,b)||j(a,b)}function i(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(e(b)&&(d=b.then,f(d)))return a.on("promise:cancelled",function(){f(b.cancel)&&b.cancel()}),d.call(b,function(d){return c?!0:(c=!0,b!==d?h(a,d):j(a,d),void 0)},function(b){return c?!0:(c=!0,k(a,b),void 0)}),!0}catch(g){return k(a,g),!0}return!1}function j(a,b){m.async(function(){a.isFulfilled||a.isRejected||(a.trigger("promise:resolved",{detail:b}),a.isFulfilled=!0,a.fulfillmentValue=b)})}function k(a,b){m.async(function(){a.isFulfilled||a.isRejected||(a.trigger("promise:failed",{detail:b}),a.isRejected=!0,a.rejectedReason=b)})}function l(a,b){m.async(function(){a.trigger("promise:notified",{detail:b})})}var m=a.config,n=b.EventTarget,o=c.CancellationError,p=function(a,b){var c=this,d=!1;if("function"!=typeof a)throw new TypeError("You must pass a resolver function as the sole argument to the promise constructor");if(void 0!==b&&"function"!=typeof b)throw new TypeError("You can only pass a canceller function as the second argument to the promise constructor");if(!(c instanceof p))return new p(a,b);var e=function(a){d||(d=!0,h(c,a))},f=function(a){d||(d=!0,k(c,a))},i=function(a){d||l(c,a)};this.on("promise:failed",function(a){this.trigger("error",{detail:a.detail})},this),this.on("error",g),this.cancel=function(){if(!d){if(void 0!==b)try{b()}catch(a){return f(a),void 0}f(new o)}};try{a(e,f,i)}catch(j){f(j)}},q=function(a,b,c,d){var e,g,j,l,m=f(c);if(!b.isFulfilled&&!b.isRejected){if(m)try{e=c(d.detail),j=!0}catch(n){l=!0,g=n}else e=d.detail,j=!0;i(b,e)||(m&&j?h(b,e):l?k(b,g):"resolve"===a?h(b,e):"reject"===a&&k(b,e))}},r=function(a,b,c){var d;if("function"==typeof b){try{d=b(c.detail)}catch(e){return}l(a,d)}else l(a,c.detail)};p.prototype={constructor:p,isRejected:void 0,isFulfilled:void 0,rejectedReason:void 0,fulfillmentValue:void 0,then:function(a,b,c){this.off("error",g);var d=new this.constructor(function(){},function(){d.trigger("promise:cancelled",{})});return this.isFulfilled&&m.async(function(b){q("resolve",d,a,{detail:b.fulfillmentValue})},this),this.isRejected&&m.async(function(a){q("reject",d,b,{detail:a.rejectedReason})},this),this.on("promise:resolved",function(b){q("resolve",d,a,b)}),this.on("promise:failed",function(a){q("reject",d,b,a)}),this.on("promise:notified",function(a){r(d,c,a)}),d},fail:function(a){return this.then(null,a)},always:function(a){return this.then(a,a)}},n.mixin(p.prototype),d.Promise=p}),a("rsvp/queue",["rsvp/promise","rsvp/timeout","exports"],function(a,b,c){"use strict";function d(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}var e=a.Promise,f=b.delay;d.prototype=new Error,d.prototype.constructor=d;var g=function(){function a(){for(var a=0;2>a;a++)k[a].cancel()}var b,c,h,i,j=this,k=[];return this instanceof g?(b=new e(function(a,b){c=function(b){return i?void 0:(j.isFulfilled=!0,j.fulfillmentValue=b,i=!0,a(b))},h=function(a){return i?void 0:(j.isRejected=!0,j.rejectedReason=a,i=!0,b(a))}},a),k.push(f()),k.push(k[0].then(function(){k.splice(0,2),0===k.length&&c()})),j.cancel=function(){i||(i=!0,b.cancel(),b.fail(function(a){j.isRejected=!0,j.rejectedReason=a}))},j.then=function(){return b.then.apply(b,arguments)},j.push=function(a,b){var e,f=k[k.length-1];if(i)throw new d;return e=f.then(a,b),k.push(e),k.push(e.then(function(a){return k.splice(0,2),0!==k.length?a:(c(a),void 0)},function(a){if(k.splice(0,2),0!==k.length)throw a;h(a)})),this},void 0):new g};g.prototype=Object.create(e.prototype),g.prototype.constructor=g,c.Queue=g,c.ResolvedQueueError=d}),a("rsvp/reject",["rsvp/promise","exports"],function(a,b){"use strict";function c(a){return new d(function(b,c){c(a)})}var d=a.Promise;b.reject=c}),a("rsvp/resolve",["rsvp/promise","exports"],function(a,b){"use strict";function c(a){return new d(function(b,c){if("object"==typeof a&&null!==a){var d=a.then;if(void 0!==d&&"function"==typeof d)return d.apply(a,[b,c])}return b(a)},function(){void 0!==a&&void 0!==a.cancel&&a.cancel()})}var d=a.Promise;b.resolve=c}),a("rsvp/rethrow",["exports"],function(a){"use strict";function b(a){throw c.setTimeout(function(){throw a}),a}var c="undefined"==typeof global?this:global;a.rethrow=b}),a("rsvp/timeout",["rsvp/promise","exports"],function(a,b){"use strict";function c(a,b,c){function d(d,e){g=setTimeout(function(){b?e(c):d(c)},a)}function e(){clearTimeout(g)}var g;return new f(d,e)}function d(a,b){return c(a,!1,b)}function e(a){return c(a,!0,"Timed out after "+a+" ms")}var f=a.Promise;f.prototype.delay=function(a){return this.then(function(b){return d(a,b)})},b.delay=d,b.timeout=e}),a("rsvp",["rsvp/events","rsvp/cancellation_error","rsvp/promise","rsvp/node","rsvp/all","rsvp/queue","rsvp/timeout","rsvp/hash","rsvp/rethrow","rsvp/defer","rsvp/config","rsvp/resolve","rsvp/reject","exports"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";function o(a,b){C[a]=b}var p=a.EventTarget,q=b.CancellationError,r=c.Promise,s=d.denodeify,t=e.all,u=e.any,v=f.Queue,w=f.ResolvedQueueError,x=g.delay,y=g.timeout,z=h.hash,A=i.rethrow,B=j.defer,C=k.config,D=l.resolve,E=m.reject;n.CancellationError=q,n.Promise=r,n.EventTarget=p,n.all=t,n.any=u,n.Queue=v,n.ResolvedQueueError=w,n.delay=x,n.timeout=y,n.hash=z,n.rethrow=A,n.defer=B,n.denodeify=s,n.configure=o,n.resolve=D,n.reject=E}),window.RSVP=b("rsvp")}(window);
\ No newline at end of file
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<script src="../src/lib/jquery.js"></script> <script src="../src/lib/jquery.js"></script>
<script src="../src/lib/qunit/qunit.js"></script> <script src="../src/lib/qunit/qunit.js"></script>
<script src="../src/lib/sinon/sinon.js"></script> <script src="../src/lib/sinon/sinon.js"></script>
<script src="../src/lib/rsvp.js"></script>
<script src="../src/lib/jschannel.js"></script> <script src="../src/lib/jschannel.js"></script>
<script src="../src/lib/renderjs.js"></script> <script src="../src/lib/renderjs.js"></script>
<script src="bw-gadget-test.js"></script> <script src="bw-gadget-test.js"></script>
...@@ -18,6 +19,5 @@ ...@@ -18,6 +19,5 @@
<body> <body>
<div id="qunit"></div> <div id="qunit"></div>
<div id="qunit-fixture"></div> <div id="qunit-fixture"></div>
<div id="gadget" style="display:none;"></div>
</body> </body>
</html> </html>
...@@ -20,12 +20,12 @@ QUnit.config.testTimeout = 1000; ...@@ -20,12 +20,12 @@ QUnit.config.testTimeout = 1000;
return $('iframe').contents().find(selectorString); return $('iframe').contents().find(selectorString);
} }
rJS(window).ready(function () { rJS(window).ready(function (g) {
var g = rJS(this), var gadget_context = document.getElementById('qunit-fixture');
gadget_context = g.context.find('#gadget').first();
asyncTest("Bootstrap wysiwyg loading", 1, function () { asyncTest("[bootstrap wysiwyg] loading (iframed)", 1, function () {
g.declareIframedGadget(bwGadgetURL, gadget_context) g.declareGadget(bwGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function () { .then(function () {
var edattr = iframeSelector("#editor").attr('contenteditable'); var edattr = iframeSelector("#editor").attr('contenteditable');
equal(edattr,"true"); equal(edattr,"true");
...@@ -33,8 +33,10 @@ QUnit.config.testTimeout = 1000; ...@@ -33,8 +33,10 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("Bootstrap wysiwyg loading : textarea is empty", 1, function () { asyncTest("[bootstrap wysiwyg] textarea start empty (iframed)", 1,
g.declareIframedGadget(bwGadgetURL, gadget_context) function () {
g.declareGadget(bwGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function () { .then(function () {
var ed = iframeSelector("#editor"); var ed = iframeSelector("#editor");
equal(ed.html(),""); equal(ed.html(),"");
...@@ -42,8 +44,9 @@ QUnit.config.testTimeout = 1000; ...@@ -42,8 +44,9 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("clear content of editor", 1, function () { asyncTest("[bootstrap wysiwyg] clear content (iframed)", 1, function () {
g.declareIframedGadget(bwGadgetURL, gadget_context) g.declareGadget(bwGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function (gadget) { .then(function (gadget) {
iframeSelector('#editor').html('A value'); iframeSelector('#editor').html('A value');
return gadget; return gadget;
...@@ -56,8 +59,10 @@ QUnit.config.testTimeout = 1000; ...@@ -56,8 +59,10 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("get content of editor", 1, function () { asyncTest("[bootstrap wysiwyg] get content (iframed)", 1,
g.declareIframedGadget(bwGadgetURL, gadget_context) function () {
g.declareGadget(bwGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function (gadget) { .then(function (gadget) {
iframeSelector('#editor').html('A value'); iframeSelector('#editor').html('A value');
return gadget; return gadget;
...@@ -70,10 +75,11 @@ QUnit.config.testTimeout = 1000; ...@@ -70,10 +75,11 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("set content of sheet", 2, function () { asyncTest("[bootstrap wysiwyg] set content (iframed)", 2, function () {
var gadget, content; var gadget, content;
g.declareIframedGadget(bwGadgetURL, gadget_context) g.declareGadget(bwGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function (gd) { .then(function (gd) {
iframeSelector('#editor').html('A value'); iframeSelector('#editor').html('A value');
gadget = gd; gadget = gd;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<script src="../src/lib/jquery.js"></script> <script src="../src/lib/jquery.js"></script>
<script src="../src/lib/qunit/qunit.js"></script> <script src="../src/lib/qunit/qunit.js"></script>
<script src="../src/lib/sinon/sinon.js"></script> <script src="../src/lib/sinon/sinon.js"></script>
<script src="../src/lib/rsvp.js"></script>
<script src="../src/lib/jschannel.js"></script> <script src="../src/lib/jschannel.js"></script>
<script src="../src/lib/renderjs.js"></script> <script src="../src/lib/renderjs.js"></script>
<script src="codemirror-gadget-test.js"></script> <script src="codemirror-gadget-test.js"></script>
...@@ -18,6 +19,5 @@ ...@@ -18,6 +19,5 @@
<body> <body>
<div id="qunit"></div> <div id="qunit"></div>
<div id="qunit-fixture"></div> <div id="qunit-fixture"></div>
<div id="gadget" style="display:none;"></div>
</body> </body>
</html> </html>
...@@ -20,20 +20,21 @@ QUnit.config.testTimeout = 1000; ...@@ -20,20 +20,21 @@ QUnit.config.testTimeout = 1000;
return $('iframe').contents().find(selectorString); return $('iframe').contents().find(selectorString);
} }
rJS(window).ready(function () { rJS(window).ready(function (g) {
var g = rJS(this), var gadget_context = document.getElementById('qunit-fixture');
gadget_context = g.context.find('#gadget').first();
asyncTest("[codemirror gadget] loading", 1, function () { asyncTest("[codemirror gadget] loading (iframed)", 1, function () {
g.declareIframedGadget(codemirrorGadgetURL, gadget_context) g.declareGadget(codemirrorGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function () { .then(function () {
ok(iframeSelector(".CodeMirror")[0]); ok(iframeSelector(".CodeMirror")[0]);
}) })
.always(start); .always(start);
}); });
asyncTest("[codemirror gadget] empty initial textarea", 1, function () { asyncTest("[codemirror gadget] empty initial textarea (iframed)", 1, function () {
g.declareIframedGadget(codemirrorGadgetURL, gadget_context) g.declareGadget(codemirrorGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function (gadget) { .then(function (gadget) {
return gadget.getContent(); return gadget.getContent();
}) })
...@@ -43,9 +44,10 @@ QUnit.config.testTimeout = 1000; ...@@ -43,9 +44,10 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("[codemirror gadget] clear content", 1, function () { asyncTest("[codemirror gadget] clear content (iframed)", 1, function () {
var gadget; var gadget;
g.declareIframedGadget(codemirrorGadgetURL, gadget_context) g.declareGadget(codemirrorGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function (g) { .then(function (g) {
gadget = g; gadget = g;
return gadget.setContent("A content"); return gadget.setContent("A content");
...@@ -62,9 +64,10 @@ QUnit.config.testTimeout = 1000; ...@@ -62,9 +64,10 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("[codemirror gadget] set/get content", 1, function () { asyncTest("[codemirror gadget] set/get content (iframed)", 1, function () {
var gadget; var gadget;
g.declareIframedGadget(codemirrorGadgetURL, gadget_context) g.declareGadget(codemirrorGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function (g) { .then(function (g) {
gadget = g; gadget = g;
return gadget.setContent("A content"); return gadget.setContent("A content");
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<script src="../src/lib/jquery.js"></script> <script src="../src/lib/jquery.js"></script>
<script src="../src/lib/qunit/qunit.js"></script> <script src="../src/lib/qunit/qunit.js"></script>
<script src="../src/lib/sinon/sinon.js"></script> <script src="../src/lib/sinon/sinon.js"></script>
<script src="../src/lib/rsvp.js"></script>
<script src="../src/lib/jschannel.js"></script> <script src="../src/lib/jschannel.js"></script>
<script src="../src/lib/renderjs.js"></script> <script src="../src/lib/renderjs.js"></script>
<script src="jqs-gadget-test.js"></script> <script src="jqs-gadget-test.js"></script>
...@@ -18,6 +19,5 @@ ...@@ -18,6 +19,5 @@
<body> <body>
<div id="qunit"></div> <div id="qunit"></div>
<div id="qunit-fixture"></div> <div id="qunit-fixture"></div>
<div id="gadget" style="display:none;"></div>
</body> </body>
</html> </html>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/*jslint indent: 2, maxerr: 3, maxlen: 79 */ /*jslint indent: 2, maxerr: 3, maxlen: 79 */
"use strict"; "use strict";
QUnit.config.testTimeout = 1000; QUnit.config.testTimeout = 5000;
(function (window, $, QUnit, rJS) { (function (window, $, QUnit, rJS) {
...@@ -21,27 +21,28 @@ QUnit.config.testTimeout = 1000; ...@@ -21,27 +21,28 @@ QUnit.config.testTimeout = 1000;
return res+n+"_table0_cell_c"+i+"_r"+j; return res+n+"_table0_cell_c"+i+"_r"+j;
} }
rJS(window).ready(function () { rJS(window).ready(function (g) {
var g = rJS(this), var gadget_context = document.getElementById('qunit-fixture');
gadget_context = g.context.find('#gadget').first();
asyncTest("[jquery.sheet] loading (iframed)", 2, function () {
asyncTest("(iframe) jquery.sheet loading: sheet loads", 2, function () {
var c0r0 = buildSelector(0,0,0); var c0r0 = buildSelector(0,0,0);
var c1r1 = buildSelector(0,1,1); var c1r1 = buildSelector(0,1,1);
g.declareIframedGadget(jqsGadgetURL, gadget_context) g.declareGadget(jqsGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function () { .then(function () {
ok(iframeSelector(c0r0).length != 0); ok(iframeSelector(c0r0).length != 0);
ok(iframeSelector(c1r1).length != 0); ok(iframeSelector(c1r1).length != 0);
}) })
.always(start); .always(start);
}); });
asyncTest("(iframe) jquery.sheet loading: sheet is empty", 2, function () { asyncTest("[jquery.sheet] sheet start empty (iframed)", 2, function () {
var c0r0 = buildSelector(0,0,0); var c0r0 = buildSelector(0,0,0);
var c1r1 = buildSelector(0,1,1); var c1r1 = buildSelector(0,1,1);
g.declareIframedGadget(jqsGadgetURL, gadget_context) g.declareGadget(jqsGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function () { .then(function () {
equal(iframeSelector(c0r0).html(),""); equal(iframeSelector(c0r0).html(),"");
equal(iframeSelector(c1r1).html(),""); equal(iframeSelector(c1r1).html(),"");
...@@ -49,11 +50,12 @@ QUnit.config.testTimeout = 1000; ...@@ -49,11 +50,12 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("(iframe) clear content", 2, function () { asyncTest("[jquery.sheet] clear content (iframed)", 2, function () {
var c0r0 = buildSelector(0,0,0); var c0r0 = buildSelector(0,0,0);
var c1r1 = buildSelector(0,1,1); var c1r1 = buildSelector(0,1,1);
g.declareIframedGadget(jqsGadgetURL, gadget_context) g.declareGadget(jqsGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function (gadget) { .then(function (gadget) {
iframeSelector(c0r0).html('c0r0Value'); iframeSelector(c0r0).html('c0r0Value');
iframeSelector(c1r1).html('c1r1Value'); iframeSelector(c1r1).html('c1r1Value');
...@@ -68,11 +70,12 @@ QUnit.config.testTimeout = 1000; ...@@ -68,11 +70,12 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("(iframe) get content of sheet", 2, function () { asyncTest("[jquery.sheet] get content (iframed)", 2, function () {
var c0r0 = buildSelector(0,0,0); var c0r0 = buildSelector(0,0,0);
var c1r1 = buildSelector(0,1,1); var c1r1 = buildSelector(0,1,1);
g.declareIframedGadget(jqsGadgetURL, gadget_context) g.declareGadget(jqsGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function (gadget) { .then(function (gadget) {
iframeSelector(c0r0).html('c0r0Value'); iframeSelector(c0r0).html('c0r0Value');
iframeSelector(c1r1).html('c1r1Value'); iframeSelector(c1r1).html('c1r1Value');
...@@ -88,14 +91,15 @@ QUnit.config.testTimeout = 1000; ...@@ -88,14 +91,15 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("(iframe) set content of sheet", 4, function () { asyncTest("[jquery.sheet] set content (iframed)", 4, function () {
var gadget, content, var gadget, content,
t0c0r0 = buildSelector(0,0,0), t0c0r0 = buildSelector(0,0,0),
t0c1r1 = buildSelector(0,1,1), t0c1r1 = buildSelector(0,1,1),
t2c0r0 = buildSelector(2,0,0), t2c0r0 = buildSelector(2,0,0),
t2c1r1 = buildSelector(2,1,1); t2c1r1 = buildSelector(2,1,1);
g.declareIframedGadget(jqsGadgetURL, gadget_context) g.declareGadget(jqsGadgetURL,
{sandbox: "iframe", element: gadget_context})
.then(function (gd) { .then(function (gd) {
iframeSelector(t0c0r0).html('c0r0Value'); iframeSelector(t0c0r0).html('c0r0Value');
iframeSelector(t0c1r1).html('c1r1Value'); iframeSelector(t0c1r1).html('c1r1Value');
...@@ -118,100 +122,98 @@ QUnit.config.testTimeout = 1000; ...@@ -118,100 +122,98 @@ QUnit.config.testTimeout = 1000;
.always(start); .always(start);
}); });
asyncTest("jquery.sheet loading : sheet loads", 2, function () { // asyncTest("jquery.sheet loading : sheet loads", 2, function () {
var c0r0 = buildSelector(0,0,0); // var c0r0 = buildSelector(0,0,0);
var c1r1 = buildSelector(0,1,1); // var c1r1 = buildSelector(0,1,1);
g.declareGadget(jqsGadgetURL, gadget_context) // g.declareGadget(jqsGadgetURL, {element: gadget_context})
.then(function () { // .then(function () {
ok($(c0r0).length != 0); // ok($(c0r0).length != 0);
ok($(c1r1).length != 0); // ok($(c1r1).length != 0);
}) // })
.always(start); // .always(start);
}); // });
asyncTest("jquery.sheet loading: sheet is empty", 2, function () { // asyncTest("jquery.sheet loading: sheet is empty", 2, function () {
var c0r0 = buildSelector(0,0,0); // var c0r0 = buildSelector(0,0,0);
var c1r1 = buildSelector(0,1,1); // var c1r1 = buildSelector(0,1,1);
g.declareIframedGadget(jqsGadgetURL, gadget_context) // g.declareGadget(jqsGadgetURL, {element: gadget_context})
.then(function () { // .then(function () {
equal($(c0r0).html(),""); // equal($(c0r0).html(),"");
equal($(c1r1).html(),""); // equal($(c1r1).html(),"");
}) // })
.always(start); // .always(start);
}); // });
asyncTest("clear content", 2, function () { // asyncTest("clear content", 2, function () {
var c0r0 = buildSelector(0,0,0); // var c0r0 = buildSelector(0,0,0);
var c1r1 = buildSelector(0,1,1); // var c1r1 = buildSelector(0,1,1);
g.declareIframedGadget(jqsGadgetURL, gadget_context) // g.declareGadget(jqsGadgetURL, {element: gadget_context})
.then(function (gadget) { // .then(function (gadget) {
$(c0r0).html('c0r0Value'); // $(c0r0).html('c0r0Value');
$(c1r1).html('c1r1Value'); // $(c1r1).html('c1r1Value');
return gadget; // return gadget;
}) // })
.then(function (gadget) { // .then(function (gadget) {
return gadget.clearContent().then(function () { // return gadget.clearContent().then(function () {
equal($(c0r0).text(),""); // equal($(c0r0).text(),"");
equal($(c1r1).text(),""); // equal($(c1r1).text(),"");
}); // });
}) // })
.always(start); // .always(start);
}); // });
asyncTest("get content of sheet", 2, function () { // asyncTest("get content of sheet", 2, function () {
var c0r0 = buildSelector(0,0,0); // var c0r0 = buildSelector(0,0,0);
var c1r1 = buildSelector(0,1,1); // var c1r1 = buildSelector(0,1,1);
g.declareIframedGadget(jqsGadgetURL, gadget_context) // g.declareGadget(jqsGadgetURL, {element: gadget_context})
.then(function (gadget) { // .then(function (gadget) {
$(c0r0).html('c0r0Value'); // $(c0r0).html('c0r0Value');
$(c1r1).html('c1r1Value'); // $(c1r1).html('c1r1Value');
return gadget; // return gadget;
}) // })
.then(function (gadget) { // .then(function (gadget) {
return gadget.getContent().then(function (content) { // return gadget.getContent().then(function (content) {
var json = JSON.parse(content)[0]; // var json = JSON.parse(content)[0];
equal(json.data.r0.c0.value,"c0r0Value"); // equal(json.data.r0.c0.value,"c0r0Value");
equal(json.data.r1.c1.value,"c1r1Value"); // equal(json.data.r1.c1.value,"c1r1Value");
}); // });
}) // })
.always(start); // .always(start);
}); // });
asyncTest("set content of sheet", 4, function () { // asyncTest("set content of sheet", 4, function () {
var gadget, content, // var gadget, content,
t0c0r0 = buildSelector(0,0,0), // t0c0r0 = buildSelector(0,0,0),
t0c1r1 = buildSelector(0,1,1), // t0c1r1 = buildSelector(0,1,1),
t2c0r0 = buildSelector(2,0,0), // t2c0r0 = buildSelector(2,0,0),
t2c1r1 = buildSelector(2,1,1); // t2c1r1 = buildSelector(2,1,1);
g.declareIframedGadget(jqsGadgetURL, gadget_context) // g.declareGadget(jqsGadgetURL, {element: gadget_context})
.then(function (gd) { // .then(function (gd) {
$(t0c0r0).html('c0r0Value'); // $(t0c0r0).html('c0r0Value');
$(t0c1r1).html('c1r1Value'); // $(t0c1r1).html('c1r1Value');
gadget = gd; // gadget = gd;
return gadget.getContent(); // return gadget.getContent();
}) // })
.then(function (c) { // .then(function (c) {
content = c; // content = c;
return gadget.clearContent(); // return gadget.clearContent();
}) // })
.then(function () { // .then(function () {
equal($(t0c0r0).text(),""); // equal($(t0c0r0).text(),"");
equal($(t2c1r1).text(),""); // equal($(t2c1r1).text(),"");
return gadget.setContent(content); // return gadget.setContent(content);
}) // })
.then(function () { // .then(function () {
equal($(t2c0r0).text(),"c0r0Value"); // equal($(t2c0r0).text(),"c0r0Value");
equal($(t2c1r1).text(),"c1r1Value"); // equal($(t2c1r1).text(),"c1r1Value");
}) // })
.always(start); // .always(start);
}); // });
}); });
} (window, jQuery, QUnit, rJS)); } (window, jQuery, QUnit, rJS));
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<script src="../src/lib/jquery.js"></script> <script src="../src/lib/jquery.js"></script>
<script src="../src/lib/qunit/qunit.js"></script> <script src="../src/lib/qunit/qunit.js"></script>
<script src="../src/lib/sinon/sinon.js"></script> <script src="../src/lib/sinon/sinon.js"></script>
<script src="../src/lib/rsvp.js"></script>
<script src="../src/lib/jschannel.js"></script> <script src="../src/lib/jschannel.js"></script>
<script src="../src/lib/renderjs.js"></script> <script src="../src/lib/renderjs.js"></script>
<script src="bw-gadget-test.js"></script> <script src="bw-gadget-test.js"></script>
...@@ -20,6 +21,5 @@ ...@@ -20,6 +21,5 @@
<body> <body>
<div id="qunit"></div> <div id="qunit"></div>
<div id="qunit-fixture"></div> <div id="qunit-fixture"></div>
<div id="gadget" style="display:none;"></div>
</body> </body>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment