Permalink
Browse files

Switch to using enyo.Object.bindSafely

Enyo-DCO-1.1-Signed-Off-By: Ben Combee (ben.combee@lge.com)
  • Loading branch information...
1 parent 58a493f commit d984d735957a5bd46af5c15cf3239abfc9040cdf Ben Combee committed Mar 27, 2013
Showing with 23 additions and 23 deletions.
  1. +2 −2 analyzer/Reader.js
  2. +2 −2 analyzer/Walker.js
  3. +1 −1 analyzer2/Reader.js
  4. +2 −2 analyzer2/Walker.js
  5. +12 −12 test/TestSuite.js
  6. +2 −2 utils/job.js
  7. +2 −2 youtube/YouTube.js
View
@@ -23,7 +23,7 @@ enyo.kind({
loadModule: function(inModule) {
enyo.xhr.request({
url: inModule.path,
- callback: enyo.bind(this, "moduleLoaded", inModule)
+ callback: this.bindSafely("moduleLoaded", inModule)
});
},
moduleLoaded: function(inModule, inCode) {
@@ -33,7 +33,7 @@ enyo.kind({
addModule: function(inModule, inCode) {
if (inCode && inCode.length) {
var module = new enyo.Documentor(inCode).results;
- this.modules[inModule.path] = module;
+ this.modules[inModule.path] = module;
enyo.mixin(module, inModule);
}
},
View
@@ -21,8 +21,8 @@ enyo.kind({
// control logging
this.loader.verbose = this.verbose;
// callbacks
- this.loader.report = enyo.bind(this, "walkReport");
- this.loader.finish = enyo.bind(this, "walkFinish");
+ this.loader.report = this.bindSafely("walkReport");
+ this.loader.finish = this.bindSafely("walkFinish");
// substitute for default loader
enyo.loader = this.loader;
// walk application dependencies
View
@@ -19,7 +19,7 @@ enyo.kind({
loadFile: function(inFile) {
enyo.xhr.request({
url: inFile.path,
- callback: enyo.bind(this, "fileLoaded", inFile)
+ callback: this.bindSafely("fileLoaded", inFile)
});
},
fileLoaded: function(inFile, inCode) {
View
@@ -19,8 +19,8 @@ enyo.kind({
// control logging
this.loader.verbose = this.verbose;
// callbacks
- this.loader.report = enyo.bind(this, "walkReport");
- this.loader.finish = enyo.bind(this, "walkFinish");
+ this.loader.report = this.bindSafely("walkReport");
+ this.loader.finish = this.bindSafely("walkFinish");
/*
TERRIBLE HACK: substitute for default loader
View
@@ -6,7 +6,7 @@ Test Package Wish list:
Collapse success results for a suite, so large swaths of green don't hide the red.
Expandable stack trace & logging for failures, so they can be collapsed by default.
Support for async beforeEach & afterEach
-Jasmine style assert mechanism, so we can have fancy english text for failures
+Jasmine style assert mechanism, so we can have fancy english text for failures
e.g., this.assert("spreadsheet total", total).equals(15) yields "Expected spreadsheet total 12 to equal 15"
*/
@@ -15,15 +15,15 @@ Jasmine style assert mechanism, so we can have fancy english text for failures
/**
To implement a suite of unit tests, create a subkind of enyo.TestSuite.
Any methods in your subkind that begin with 'test' will be invoked as unit tests when the test runner executes.
-
- When each test is complete, it should call this.finish().
+
+ When each test is complete, it should call this.finish().
Pass nothing for success, or something truthy for failure (usually an explanatory message or an exception object).
- If you do not call finish(), your test will be failed after a 3-second timeout.
+ If you do not call finish(), your test will be failed after a 3-second timeout.
This timeout can be customized for a given test by calling this.resetTimeout(ms).
-
-
+
+
See enyo-support/tests for example framework tests.
-
+
*/
enyo.kind({
name: "enyo.TestSuite",
@@ -36,14 +36,14 @@ enyo.kind({
timeout: 3000,
timeoutMessage: "timed out",
/** @public
- Replaces the current test timeout with
+ Replaces the current test timeout with
May be called by individual tests to reset/lengthen/shorten the test timeout.
- Mostly good for unusually long-running tests, but can be used for shortening the timeout duration, or
+ Mostly good for unusually long-running tests, but can be used for shortening the timeout duration, or
even for setting different timeouts for successive stages of a test.
*/
resetTimeout: function(timeout) {
this.clearTimer();
- this.timer = window.setTimeout(enyo.bind(this, "timedout"), timeout || this.timeout);
+ this.timer = window.setTimeout(this.bindSafely("timedout"), timeout || this.timeout);
},
/** @public
Tests can call this.log() to print useful diagnostic information.
@@ -134,7 +134,7 @@ enyo.kind({
enyo.asyncMethod(this, "reallyFinish", inMessage);
},
reallyFinish: function(inMessage) {
- // If finish has been called before, then we ignore it
+ // If finish has been called before, then we ignore it
// unless we passed previously and now we're failing.
// We will send multiple finish events if we get a success and then a failure -- that counts as a failure.
if (this.results) {
@@ -193,7 +193,7 @@ enyo.kind({
enyo.asyncMethod(this, "next");
}
}
-
+
});
enyo.TestSuite.tests = [];
View
@@ -6,9 +6,9 @@
times, but we want a response to occur only once every so many seconds, we can use a job.
onscroll: function() {
- // updateThumb will be called but only when 1s has elapsed since the
+ // updateThumb will be called but only when 1s has elapsed since the
// last onscroll
- enyo.job("updateThumb", enyo.bind(this, "updateThumb"), 1000);
+ enyo.job("updateThumb", this.bindSafely("updateThumb"), 1000);
}
*/
enyo.job = function(inJobName, inJob, inWait) {
View
@@ -45,8 +45,8 @@ enyo.kind({
width: '100%',
videoId: this.videoId,
events: {
- onReady: enyo.bind(this, "playerReady"),
- onStateChange: enyo.bind(this, "playerStateChange")
+ onReady: this.bindSafely("playerReady"),
+ onStateChange: this.bindSafely("playerStateChange")
}
});
// positioning hack

0 comments on commit d984d73

Please sign in to comment.