Confirmed users
14,525
edits
Line 74: | Line 74: | ||
; Function Signatures | ; Function Signatures | ||
* Proposed Guidelines: | * Proposed Guidelines: | ||
** var nameOfFunction = function() { | ** Top-level functions should be named ie. function testDisableEnablePlugin() { | ||
** All other functions should be anonymous ie. var nameOfFunction = function() { | |||
** Opening brace should exist on the signature line | |||
* Geo: Only top-level and object funtions should be named | |||
* Geo: Agree on open-brace on same line but common in JS to have an next-line exception for named functions; could go either way. | * Geo: Agree on open-brace on same line but common in JS to have an next-line exception for named functions; could go either way. | ||
Line 133: | Line 136: | ||
</pre> | </pre> | ||
* Geo: Element getting will be considerably simpler post-refactor and won’t require a long line. | * Geo: Element getting will be considerably simpler post-refactor and won’t require a long line. | ||
; Iteration | ; Iteration | ||
Line 147: | Line 149: | ||
* Henrik: index and array are optional but can be helpful in some cases when you need the current index or other elements from the array. | * Henrik: index and array are optional but can be helpful in some cases when you need the current index or other elements from the array. | ||
; | ; Word-wrapping and Indentation | ||
* Proposed Guideline: | * Proposed Guideline: | ||
** Adhere to an 80 character per line limitation | ** Adhere to an 80 character per line limitation | ||
Line 192: | Line 194: | ||
** Avoid use of sleep() where possible and use waitFor() instead | ** Avoid use of sleep() where possible and use waitFor() instead | ||
* Geo: If you’re only saving a few milliseconds and not causing a robustness issue, you should use sleep for simplicity’s sake. | * Geo: If you’re only saving a few milliseconds and not causing a robustness issue, you should use sleep for simplicity’s sake. | ||
; Misc Tests | |||
* Proposed Guideline: | |||
** No "general" or "misc" tests should exist ie. no firefox/testGeneral/ | |||
* Geo: Sometimes a “misc” folder makes sense. We just might be leaning on it too hard. Agree we should review the organization. | |||
; One Test per File | |||
* Proposed Guideline: | |||
** Only one test per file | |||
* Geo: Basically OK with that. This means we’ll be managing thousands of files eventually. However, unit test “common setup” paradigm doesn’t work that well with UI tests, I’m cool subverting it with 1:1. | |||
; Commenting | |||
* Proposed Guideline: | |||
** Block-style for function headers | |||
** JSDoc-style for additional helper functions | |||
; Camel-case | |||
* Proposed Guideline: | |||
** Use camel-case for all non-constant variables and functions | |||
<pre> | |||
var thisIsAVariable = value; | |||
var thisIsATestMethod = function() { | |||
</pre> | |||
== Notes on the Goals == | |||
* Geo: Style guide should offer guidelines for... | |||
** naming/caps | |||
** commenting style | |||
** block style | |||
** indentation style | |||
** line length | |||
** local idioms (waitFor, assert) | |||
** things we lock down because alternatives are risky (array.forEach) | |||
* Aaron: We should offer style guidelines on the license block |