diff options
| author | Stephen Blott | 2015-06-20 06:15:45 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-06-20 07:00:24 +0100 | 
| commit | 1e671e28fd1f348b17ee16351c1a0b03f9d15e4f (patch) | |
| tree | f8f8b21e2c57a1aac998383f2e52cda10c080ba8 /pages | |
| parent | 21a5405e9b12201ed96c7de93d94410a3d448979 (diff) | |
| download | vimium-1e671e28fd1f348b17ee16351c1a0b03f9d15e4f.tar.bz2 | |
Add test that every option has a default value.
This prevents issues like #1731 and is an (better) alternative to #1732.
Diffstat (limited to 'pages')
| -rw-r--r-- | pages/options.coffee | 41 | 
1 files changed, 22 insertions, 19 deletions
| diff --git a/pages/options.coffee b/pages/options.coffee index 88acbf51..1cbe88fa 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -181,6 +181,24 @@ class ExclusionRulesOnPopupOption extends ExclusionRulesOption      else        @url + "*" +Options = +  exclusionRules: ExclusionRulesOption +  filterLinkHints: CheckBoxOption +  hideHud: CheckBoxOption +  keyMappings: TextOption +  linkHintCharacters: NonEmptyTextOption +  linkHintNumbers: NonEmptyTextOption +  newTabUrl: NonEmptyTextOption +  nextPatterns: NonEmptyTextOption +  previousPatterns: NonEmptyTextOption +  regexFindMode: CheckBoxOption +  scrollStepSize: NumberOption +  smoothScroll: CheckBoxOption +  grabBackFocus: CheckBoxOption +  searchEngines: TextOption +  searchUrl: NonEmptyTextOption +  userDefinedLinkHintCss: TextOption +  initOptionsPage = ->    onUpdated = ->      $("saveOptions").removeAttribute "disabled" @@ -238,26 +256,8 @@ initOptionsPage = ->        document.activeElement.blur() if document?.activeElement?.blur        saveOptions() -  options = -    exclusionRules: ExclusionRulesOption -    filterLinkHints: CheckBoxOption -    hideHud: CheckBoxOption -    keyMappings: TextOption -    linkHintCharacters: NonEmptyTextOption -    linkHintNumbers: NonEmptyTextOption -    newTabUrl: NonEmptyTextOption -    nextPatterns: NonEmptyTextOption -    previousPatterns: NonEmptyTextOption -    regexFindMode: CheckBoxOption -    scrollStepSize: NumberOption -    smoothScroll: CheckBoxOption -    grabBackFocus: CheckBoxOption -    searchEngines: TextOption -    searchUrl: NonEmptyTextOption -    userDefinedLinkHintCss: TextOption -    # Populate options. The constructor adds each new object to "Option.all". -  for name, type of options +  for name, type of Options      new type(name,onUpdated)    maintainLinkHintsView() @@ -319,3 +319,6 @@ document.addEventListener "DOMContentLoaded", ->    xhr.send() +# Exported for tests. +root = exports ? window +root.Options = Options | 
