2012-12-28 02:31:13 +04:00
|
|
|
$ = require 'jquery'
|
2013-04-03 22:01:01 +04:00
|
|
|
fsUtils = require 'fs-utils'
|
2012-12-28 02:31:13 +04:00
|
|
|
Theme = require 'theme'
|
|
|
|
|
2012-12-28 06:17:53 +04:00
|
|
|
describe "@load(name)", ->
|
2013-01-01 00:25:03 +04:00
|
|
|
theme = null
|
2012-12-28 04:09:31 +04:00
|
|
|
|
|
|
|
beforeEach ->
|
|
|
|
$("#jasmine-content").append $("<div class='editor'></div>")
|
|
|
|
|
|
|
|
afterEach ->
|
2013-01-01 00:25:03 +04:00
|
|
|
theme.deactivate()
|
2012-12-28 04:09:31 +04:00
|
|
|
|
|
|
|
describe "TextMateTheme", ->
|
2012-12-28 03:25:16 +04:00
|
|
|
it "applies the theme's stylesheet to the current window", ->
|
2012-12-28 04:09:31 +04:00
|
|
|
expect($(".editor").css("background-color")).not.toBe("rgb(20, 20, 20)")
|
|
|
|
|
2013-04-03 22:01:01 +04:00
|
|
|
themePath = fsUtils.resolveOnLoadPath(fsUtils.join('fixtures', 'test.tmTheme'))
|
2013-01-01 00:25:03 +04:00
|
|
|
theme = Theme.load(themePath)
|
2012-12-28 04:09:31 +04:00
|
|
|
expect($(".editor").css("background-color")).toBe("rgb(20, 20, 20)")
|
2012-12-28 03:25:16 +04:00
|
|
|
|
2012-12-28 04:09:31 +04:00
|
|
|
describe "AtomTheme", ->
|
2013-03-09 04:27:14 +04:00
|
|
|
describe "when the theme is a file", ->
|
|
|
|
it "loads and applies css", ->
|
|
|
|
expect($(".editor").css("padding-bottom")).not.toBe "1234px"
|
|
|
|
themePath = project.resolve('themes/theme-stylesheet.css')
|
|
|
|
theme = Theme.load(themePath)
|
|
|
|
expect($(".editor").css("padding-top")).toBe "1234px"
|
|
|
|
|
|
|
|
it "parses, loads and applies less", ->
|
|
|
|
expect($(".editor").css("padding-bottom")).not.toBe "1234px"
|
|
|
|
themePath = project.resolve('themes/theme-stylesheet.less')
|
|
|
|
theme = Theme.load(themePath)
|
|
|
|
expect($(".editor").css("padding-top")).toBe "4321px"
|
|
|
|
|
2013-02-14 21:03:10 +04:00
|
|
|
describe "when the theme contains a package.json file", ->
|
2013-03-09 04:27:14 +04:00
|
|
|
it "loads and applies stylesheets from package.json in the correct order", ->
|
2013-02-14 21:03:10 +04:00
|
|
|
expect($(".editor").css("padding-top")).not.toBe("101px")
|
|
|
|
expect($(".editor").css("padding-right")).not.toBe("102px")
|
|
|
|
expect($(".editor").css("padding-bottom")).not.toBe("103px")
|
2012-12-28 04:09:31 +04:00
|
|
|
|
2013-02-28 21:11:06 +04:00
|
|
|
themePath = project.resolve('themes/theme-with-package-file')
|
2013-02-14 21:03:10 +04:00
|
|
|
theme = Theme.load(themePath)
|
|
|
|
expect($(".editor").css("padding-top")).toBe("101px")
|
|
|
|
expect($(".editor").css("padding-right")).toBe("102px")
|
|
|
|
expect($(".editor").css("padding-bottom")).toBe("103px")
|
|
|
|
|
|
|
|
describe "when the theme does not contain a package.json file and is a directory", ->
|
2013-03-09 04:27:14 +04:00
|
|
|
it "loads all stylesheet files in the directory", ->
|
2013-02-14 21:03:10 +04:00
|
|
|
expect($(".editor").css("padding-top")).not.toBe "10px"
|
|
|
|
expect($(".editor").css("padding-right")).not.toBe "20px"
|
|
|
|
expect($(".editor").css("padding-bottom")).not.toBe "30px"
|
|
|
|
|
2013-02-28 21:11:06 +04:00
|
|
|
themePath = project.resolve('themes/theme-without-package-file')
|
2013-02-14 21:03:10 +04:00
|
|
|
theme = Theme.load(themePath)
|
|
|
|
expect($(".editor").css("padding-top")).toBe "10px"
|
|
|
|
expect($(".editor").css("padding-right")).toBe "20px"
|
|
|
|
expect($(".editor").css("padding-bottom")).toBe "30px"
|