rtlize 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +6 -0
- data/lib/rtlize/rtlizer.rb +49 -7
- data/lib/rtlize/version.rb +1 -1
- data/test/dummy/log/development.log +2 -5
- data/test/dummy/log/test.log +1595 -3
- data/test/unit/rtlizer_test.rb +48 -0
- metadata +11 -7
- data/test/dummy/db/development.sqlite3 +0 -0
data/test/unit/rtlizer_test.rb
CHANGED
@@ -46,11 +46,42 @@ class RtlizerTest < ActiveSupport::TestCase
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
test "Should transform the box-shadow properties" do
|
50
|
+
["box-shadow", "-moz-box-shadow", "-webkit-box-shadow"].each do |prop|
|
51
|
+
assert_declaration_transformation("#{prop}: #000 1px -2px, rgba(10, 20, 30) 4px 5px;", "#{prop}: #000 -1px -2px, rgba(10, 20, 30) -4px 5px;")
|
52
|
+
assert_declaration_transformation("#{prop}: inset -1px 2px 3px #FFFFFF, -4px 5px 6px black;", "#{prop}: inset 1px 2px 3px #FFFFFF, 4px 5px 6px black;")
|
53
|
+
assert_declaration_transformation("#{prop}: 1px 2px 3px rgba(20, 40, 60, 0.5) inset;", "#{prop}: -1px 2px 3px rgba(20, 40, 60, 0.5) inset;")
|
54
|
+
assert_declaration_transformation("#{prop}: -1px -2px 3px #000 inset;", "#{prop}: 1px -2px 3px #000 inset;")
|
55
|
+
|
56
|
+
# Test when value is zero
|
57
|
+
assert_no_declaration_transformation("#{prop}: 0px 2px 3px red;")
|
58
|
+
assert_no_declaration_transformation("#{prop}: 0 2px 3px red;")
|
59
|
+
assert_no_declaration_transformation("#{prop}: -00 2px 3px red;")
|
60
|
+
|
61
|
+
# Test for different numeral values.
|
62
|
+
assert_declaration_transformation("#{prop}: 001px 2px 3px red;", "#{prop}: -001px 2px 3px red;")
|
63
|
+
assert_declaration_transformation("#{prop}: 1.5px 2px 3px red;", "#{prop}: -1.5px 2px 3px red;")
|
64
|
+
assert_declaration_transformation("#{prop}: 0.5px 2px 3px red;", "#{prop}: -0.5px 2px 3px red;")
|
65
|
+
assert_declaration_transformation("#{prop}: .5px 2px 3px red;", "#{prop}: -.5px 2px 3px red;")
|
66
|
+
assert_declaration_transformation("#{prop}: 5.55px 2px 3px red;", "#{prop}: -5.55px 2px 3px red;")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
49
70
|
test "Should transform the clear/float properties" do
|
50
71
|
assert_declaration_transformation("clear: left;", "clear: right;")
|
51
72
|
assert_declaration_transformation("float: left;", "float: right;")
|
52
73
|
end
|
53
74
|
|
75
|
+
test "Should transform the clip property" do
|
76
|
+
assert_declaration_transformation("clip: rect(1px, 2px, 3px, 4px);", "clip: rect(1px, 4px, 3px, 2px);")
|
77
|
+
end
|
78
|
+
|
79
|
+
test "Should transform the cursor property" do
|
80
|
+
assert_declaration_transformation("cursor: e-resize;", "cursor: w-resize;")
|
81
|
+
assert_declaration_transformation("cursor: ne-resize;", "cursor: nw-resize;")
|
82
|
+
assert_declaration_transformation("cursor: se-resize;", "cursor: sw-resize;")
|
83
|
+
end
|
84
|
+
|
54
85
|
test "Should transform the direction property" do
|
55
86
|
assert_declaration_transformation("direction: ltr;", "direction: rtl;")
|
56
87
|
end
|
@@ -69,10 +100,27 @@ class RtlizerTest < ActiveSupport::TestCase
|
|
69
100
|
assert_declaration_transformation("padding-left: 1px;", "padding-right: 1px;")
|
70
101
|
end
|
71
102
|
|
103
|
+
test "Should transform the rotation property" do
|
104
|
+
assert_declaration_transformation("rotation: 0;", "rotation: 0;")
|
105
|
+
assert_declaration_transformation("rotation: 360deg;", "rotation: 0deg;")
|
106
|
+
assert_declaration_transformation("rotation: 270deg;", "rotation: 90deg;")
|
107
|
+
assert_declaration_transformation("rotation: 200.5deg;", "rotation: 159.5deg;")
|
108
|
+
assert_no_declaration_transformation("rotation: 180deg;")
|
109
|
+
end
|
110
|
+
|
72
111
|
test "Should transform the text-align property" do
|
73
112
|
assert_declaration_transformation("text-align: left;", "text-align: right;")
|
74
113
|
end
|
75
114
|
|
115
|
+
test "Should transform the text-shadow property" do
|
116
|
+
["text-shadow", "-moz-text-shadow", "-webkit-text-shadow"].each do |prop|
|
117
|
+
assert_declaration_transformation("#{prop}: #000 1px -2px, rgba(10, 20, 30) 4px 5px;", "#{prop}: #000 -1px -2px, rgba(10, 20, 30) -4px 5px;")
|
118
|
+
assert_declaration_transformation("#{prop}: -1px 2px 3px #FFFFFF, -4px 5px 6px black;", "#{prop}: 1px 2px 3px #FFFFFF, 4px 5px 6px black;")
|
119
|
+
assert_declaration_transformation("#{prop}: 1px 2px 3px rgba(20, 40, 60, 0.5);", "#{prop}: -1px 2px 3px rgba(20, 40, 60, 0.5);")
|
120
|
+
assert_declaration_transformation("#{prop}: -1px -2px 3px #000;", "#{prop}: 1px -2px 3px #000;")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
76
124
|
test "Should not transform CSS rules whose selector includes .rtl" do
|
77
125
|
assert_no_transformation(".klass span.rtl #id { float: left; }")
|
78
126
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtlize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-12-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &83050120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.2.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *83050120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &83049670 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *83049670
|
36
36
|
description: RTLize is a rails plugin that semi-automatically allows you to use the
|
37
37
|
same stylesheet file(s) to produce both left-to-right and right-to-left layouts
|
38
38
|
for your markup. It does this by intelligently switching all the left/right properties
|
@@ -58,7 +58,6 @@ files:
|
|
58
58
|
- test/dummy/public/favicon.ico
|
59
59
|
- test/dummy/public/500.html
|
60
60
|
- test/dummy/db/test.sqlite3
|
61
|
-
- test/dummy/db/development.sqlite3
|
62
61
|
- test/dummy/README.rdoc
|
63
62
|
- test/dummy/Rakefile
|
64
63
|
- test/dummy/log/development.log
|
@@ -99,12 +98,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
98
|
- - ! '>='
|
100
99
|
- !ruby/object:Gem::Version
|
101
100
|
version: '0'
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
hash: 936519987
|
102
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
105
|
none: false
|
104
106
|
requirements:
|
105
107
|
- - ! '>='
|
106
108
|
- !ruby/object:Gem::Version
|
107
109
|
version: '0'
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
hash: 936519987
|
108
113
|
requirements: []
|
109
114
|
rubyforge_project:
|
110
115
|
rubygems_version: 1.8.10
|
@@ -118,7 +123,6 @@ test_files:
|
|
118
123
|
- test/dummy/public/favicon.ico
|
119
124
|
- test/dummy/public/500.html
|
120
125
|
- test/dummy/db/test.sqlite3
|
121
|
-
- test/dummy/db/development.sqlite3
|
122
126
|
- test/dummy/README.rdoc
|
123
127
|
- test/dummy/Rakefile
|
124
128
|
- test/dummy/log/development.log
|
Binary file
|