Permalink
Browse files

Another pass at de-linting tuneup

This fixes the 'double-else' problem found in issue #37
from 16a0344. I also found a couple of other lint complaints
and fixed them up.
  • Loading branch information...
1 parent 16a0344 commit 0ba42d1be6ea1b5110a1bf9e008216b3412fd756 @radiantcapsule radiantcapsule committed Oct 29, 2012
Showing with 21 additions and 21 deletions.
  1. +9 −9 assertions.js
  2. +2 −2 lang-ext.js
  3. +1 −1 screen.js
  4. +2 −2 test.js
  5. +7 −7 uiautomation-ext.js
View
@@ -7,7 +7,7 @@ function fail(message) {
/**
* Perform an assertion several times. If the assertion passes before the
- * maximum number of iterations, the assertion passes. Otherwise the
+ * maximum number of iterations, the assertion passes. Otherwise the
* assertion fails
* @param f The function to perform (possibly) multiple times
* @param maxTries (optional) The maximum number of attempts
@@ -54,7 +54,7 @@ function assertTrue(expression, message) {
}
/**
- * Asserts that the given regular expression matches the result of the
+ * Asserts that the given regular expression matches the result of the
* given message.
* @param pattern - the pattern to match
* @param expression - the expression to match against
@@ -86,7 +86,7 @@ function assertNotEquals(expected, received, message) {
}
/**
- * Asserts that the given expression is false and otherwise throws an
+ * Asserts that the given expression is false and otherwise throws an
* exception with a default message, or the optional +message+ parameter
*/
function assertFalse(expression, message) {
@@ -100,7 +100,7 @@ function assertFalse(expression, message) {
* +message+ parameter.
*/
function assertNull(thingie, message) {
- var defMessage = "Expected a null object, but received <" + thingie + ">";
+ var defMessage = "Expected a null object, but received <" + thingie + ">";
// TODO: string-matching on UIAElementNil makes my tummy feel bad. Fix it.
assertTrue(thingie === null || thingie.toString() == "[object UIAElementNil]",
message ? message + ": " + defMessage : defMessage);
@@ -113,7 +113,7 @@ function assertNull(thingie, message) {
*/
function assertNotNull(thingie, message) {
var defMessage = "Expected not null object";
- assertTrue(thingie !== null && thingie.toString() != "[object UIAElementNil]",
+ assertTrue(thingie !== null && thingie.toString() != "[object UIAElementNil]",
message ? message + ": " + defMessage : defMessage);
}
@@ -174,7 +174,7 @@ function assertElementTree(element, definition) {
* PROPERTY MATCHERS For each property you wish to make an assertion about, you
* can specify a string, number regular expression or function. Strings and
* numbers are matches using the assertEquals() method. Regular expressions are
- * matches using the assertMatch() method.
+ * matches using the assertMatch() method.
*
* If you specify 'null' for a property, it means you don't care to match.
* Typically this is done inside of arrays where you need to match the number
@@ -246,12 +246,12 @@ function assertWindow(window) {
application = target.frontMostApp();
mainWindow = application.mainWindow();
- assertElementTree(mainWindow, window)
+ assertElementTree(mainWindow, window);
}
/**
* Asserts that the +expected+ object matches the +given+ object by making
- * assertions appropriate based on the type of each property in the
+ * assertions appropriate based on the pe of each property in the
* +expected+ object. This method will recurse through the structure,
* applying assertions for each matching property path. See the description
* for +assertWindow+ for details on the matchers.
@@ -279,7 +279,7 @@ function assertPropertiesMatch(expected, given, level) {
if (typeof(givenProp) == "function") {
try {
- // We have to use eval (shudder) because calling functions on
+ // We have to use eval (shudder) because calling functions on
// UIAutomation objects with () operator crashes
// See Radar bug 8496138
givenProp = eval("given." + propName + "()");
View
@@ -6,7 +6,7 @@ function extend(destination, source) {
destination[property] = source[property];
}
return destination;
-};
+}
/**
* Dump the properties out a String returned by the function.
@@ -15,7 +15,7 @@ function dumpProperties(obj) {
var dumpStr = "";
for (var propName in obj) {
if (obj.hasOwnProperty(propName)) {
- if (dumpStr != "") {
+ if (dumpStr !== "") {
dumpStr += ", ";
}
dumpStr += (propName + "=" + obj[propName]);
View
@@ -1,5 +1,5 @@
Screen = {
- screens: new Object(),
+ screens: {},
add: function(name, definition) {
this.screens[name] = definition;
View
@@ -5,7 +5,7 @@
* a +UIApplication+ object which it can use to exercise and validate your
* application.
*
- * The +options+ parameter is an optional object/hash thingie that
+ * The +options+ parameter is an optional object/hash thingie that
* supports the following:
* logTree -- a boolean to log the element tree when the test fails (default 'true')
*
@@ -16,7 +16,7 @@
*
*/
function test(title, f, options) {
- if (options == null) {
+ if (options === null) {
options = {
logTree: true
};
View
@@ -22,10 +22,10 @@ extend(UIATableView.prototype, {
extend(UIAElement.prototype, {
// Poll till the item becomes visible, up to a specified timeout
waitUntilVisible: function (timeoutInSeconds) {
- timeoutInSeconds = timeoutInSeconds == null ? 5 : timeoutInSeconds;
+ timeoutInSeconds = timeoutInSeconds === null ? 5 : timeoutInSeconds;
var element = this;
var delay = 0.25;
- retry(function() {
+ retry(function() {
if(!element.isVisible()) {
throw("Element (" + element + ") didn't become visible within " + timeoutInSeconds + " seconds.");
}
@@ -173,14 +173,14 @@ extend(UIAKeyboard.prototype,{
TODO: Character keyboard is super slow.
*/
var typeString = function(pstrString, pbClear) {
- pstrString += ''; // convert number to string
+ pstrString += ''; // convert number to string
if (!this.hasKeyboardFocus()){
this.tap();
}
UIATarget.localTarget().delay(0.5);
- if (pbClear || pstrString.length == 0) {
+ if (pbClear || pstrString.length === 0) {
this.clear();
}
@@ -219,9 +219,9 @@ var typeString = function(pstrString, pbClear) {
strChar = "9";
} else {
strChar = "10";
- } else {
- strChar = (parseInt(strChar) - 1).toString();
}
+ } else {
+ strChar = (parseInt(strChar, 10) - 1).toString();
}
keys[strChar].tap();
} else {
@@ -233,7 +233,7 @@ var typeString = function(pstrString, pbClear) {
};
extend(UIATextField.prototype,{
- typeString: typeString,
+ typeString: typeString
});
extend(UIATextView.prototype,{
typeString: typeString

0 comments on commit 0ba42d1

Please sign in to comment.