Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added 3 simple tests

  • Loading branch information...
commit 92de2d8b4dbeceb8366b391ee64e3589eeac6beb 1 parent f9a3670
@christocracy christocracy authored
View
2  Rakefile
@@ -10,7 +10,7 @@ begin
gem.email = "christocracy@gmail.com"
gem.homepage = "http://github.com/extjs/extjs-theme"
gem.authors = ["Christopher Scott"]
- gem.add_development_dependency "thoughtbot-shoulda"
+ gem.add_development_dependency "shoulda"
gem.add_dependency "rmagick"
gem.add_dependency "haml", ">= 3.0.0.beta"
gem.files = %w(Rakefile) +
View
3  test/config/xtheme.yml
@@ -0,0 +1,3 @@
+---
+:ext_dir: public/javascripts/ext-3.x
+:theme_dir: public/stylesheets/themes
View
41 test/extjs-xtheme_test.rb
@@ -1,7 +1,42 @@
require 'test_helper'
+FileUtils.cd("test")
-class ExtjsXthemeTest < Test::Unit::TestCase
- should "probably rename this file and start testing for real" do
- flunk "hey buddy, you should probably rename this file and start testing for real"
+PUBLIC_PATH = "public"
+THEME_PATH = File.join(PUBLIC_PATH, "stylesheets", "themes")
+
+# Remove previously generated config and test theme before starting.
+FileUtils.rm("config/xtheme.yml") if File.exists?("config/xtheme.yml")
+FileUtils.rm_r(File.join(THEME_PATH, "foo")) if File.exists?(File.join(THEME_PATH, "foo"))
+
+class ThemeTest < Test::Unit::TestCase
+ context "Within a valid Rails-like app" do
+ setup {
+ `xtheme init public/javascripts/ext-3.x #{THEME_PATH}`
+ }
+
+ should "config/xtheme.yml should exist" do
+ assert File.exists?("config/xtheme.yml"), "Failed to create config/xtheme.yml"
+ end
+
+ should "generate a theme" do
+ `xtheme create foo`
+ assert (
+ File.exists?(File.join(THEME_PATH, "foo", "all.sass")) &&
+ File.exists?(File.join(THEME_PATH, "foo", "images", "rails.png")) &&
+ File.exists?(File.join(THEME_PATH, "foo", "structure", "structure.sass")) &&
+ File.exists?(File.join(THEME_PATH, "foo", "visual", "visual.sass"))
+ ), "Failed to generate theme"
+ end
+
+ should "modulate a theme" do
+ # first destroy existing default image.
+ an_image = File.join(THEME_PATH, "foo", "images", "rails.png")
+ FileUtils.rm(an_image)
+
+ # run the effect, it should create a newly modulated version of image (it should be green but how to tell?).
+ `xtheme effects:modulate foo 1.5 1.0 1.0`
+
+ assert File.exists?(an_image), "Failed to modulate images"
+ end
end
end
View
3  test/public/javascripts/ext-3.x/resources/css/structure/structure.css
@@ -0,0 +1,3 @@
+body {
+ width: 666px;
+}
View
6 test/public/javascripts/ext-3.x/resources/css/visual/visual.css
@@ -0,0 +1,6 @@
+body {
+ background: #000;
+}
+h1 {
+ color: #F00;
+}
View
BIN  test/public/javascripts/ext-3.x/resources/images/default/rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  test/public/stylesheets/themes/foo/all.sass
@@ -0,0 +1,2 @@
+@import structure/structure.sass
+@import visual/visual.sass
View
7 test/public/stylesheets/themes/foo/defines.sass
@@ -0,0 +1,7 @@
+!bg_color = #eee
+!bg_color_ghost = #cbddf3
+!border_color = #0f0
+!color = #333
+!img_path = ../themes/foo/images
+!font = tahoma,arial,verdana,sans-serif
+!hue = 90.0
View
BIN  test/public/stylesheets/themes/foo/images/rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
3  test/public/stylesheets/themes/foo/structure/structure.sass
@@ -0,0 +1,3 @@
+@import ../defines.sass
+body
+ width: 666px
View
6 test/public/stylesheets/themes/foo/visual/visual.sass
@@ -0,0 +1,6 @@
+@import ../defines.sass
+body
+ background: black
+
+h1
+ color: red
View
2  test/test_helper.rb
@@ -4,7 +4,7 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
-require 'extjs-xtheme'
+require 'extjs-theme'
class Test::Unit::TestCase
end
Please sign in to comment.
Something went wrong with that request. Please try again.