See #898. Add more tests for migrate settings helper
This commit is contained in:
parent
9add49118e
commit
4cdb738d28
|
@ -217,13 +217,28 @@ describe "Atom-Beautify", ->
|
||||||
expect(atom.config.get("atom-beautify.#{afterKey}")).toBe(val)
|
expect(atom.config.get("atom-beautify.#{afterKey}")).toBe(val)
|
||||||
|
|
||||||
it "should migrate js_indent_size to js.indent_size", ->
|
it "should migrate js_indent_size to js.indent_size", ->
|
||||||
|
migrateSettings("js_indent_size","js.indent_size", 1)
|
||||||
migrateSettings("js_indent_size","js.indent_size", 10)
|
migrateSettings("js_indent_size","js.indent_size", 10)
|
||||||
|
|
||||||
it "should migrate analytics to general.analytics", ->
|
it "should migrate analytics to general.analytics", ->
|
||||||
migrateSettings("analytics","general.analytics", true)
|
migrateSettings("analytics","general.analytics", true)
|
||||||
|
migrateSettings("analytics","general.analytics", false)
|
||||||
|
|
||||||
it "should migrate _analyticsUserId to general._analyticsUserId", ->
|
it "should migrate _analyticsUserId to general._analyticsUserId", ->
|
||||||
migrateSettings("_analyticsUserId","general._analyticsUserId", "userid")
|
migrateSettings("_analyticsUserId","general._analyticsUserId", "userid")
|
||||||
|
migrateSettings("_analyticsUserId","general._analyticsUserId", "userid2")
|
||||||
|
|
||||||
|
it "should migrate language_js_disabled to js.disabled", ->
|
||||||
|
migrateSettings("language_js_disabled","js.disabled", false)
|
||||||
|
migrateSettings("language_js_disabled","js.disabled", true)
|
||||||
|
|
||||||
|
it "should migrate language_js_default_beautifier to js.default_beautifier", ->
|
||||||
|
migrateSettings("language_js_default_beautifier","js.default_beautifier", "Pretty Diff")
|
||||||
|
migrateSettings("language_js_default_beautifier","js.default_beautifier", "JS Beautify")
|
||||||
|
|
||||||
|
it "should migrate language_js_beautify_on_save to js.beautify_on_save", ->
|
||||||
|
migrateSettings("language_js_beautify_on_save","js.beautify_on_save", true)
|
||||||
|
migrateSettings("language_js_beautify_on_save","js.beautify_on_save", false)
|
||||||
|
|
||||||
beautifyEditor = (callback) ->
|
beautifyEditor = (callback) ->
|
||||||
isComplete = false
|
isComplete = false
|
||||||
|
|
|
@ -546,9 +546,9 @@ plugin.migrateSettings = ->
|
||||||
|
|
||||||
# Move all option values to renamed key
|
# Move all option values to renamed key
|
||||||
_.each(rename, ([key, newKey]) ->
|
_.each(rename, ([key, newKey]) ->
|
||||||
# console.log('rename', key, newKey)
|
|
||||||
# Copy to new key
|
# Copy to new key
|
||||||
val = atom.config.get("atom-beautify.#{key}")
|
val = atom.config.get("atom-beautify.#{key}")
|
||||||
|
# console.log('rename', key, newKey, val)
|
||||||
atom.config.set("atom-beautify.#{newKey}", val)
|
atom.config.set("atom-beautify.#{newKey}", val)
|
||||||
# Delete old key
|
# Delete old key
|
||||||
atom.config.set("atom-beautify.#{key}", undefined)
|
atom.config.set("atom-beautify.#{key}", undefined)
|
||||||
|
|
Loading…
Reference in New Issue