Class: ExtParserTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- ExtParserTest
- Defined in:
- lib/test/test_parser.rb
Instance Method Summary collapse
- #test_parse_id_and_inline_config ⇒ Object
- #test_parse_id_class_and_inline_config ⇒ Object
- #test_parse_inline_config_with_integer_value ⇒ Object
- #test_parse_key_consist_classname ⇒ Object
- #test_parse_key_consist_dash ⇒ Object
- #test_parse_key_consist_id ⇒ Object
- #test_parse_key_consist_mix_class_and_id ⇒ Object
- #test_parse_key_consist_multiclass ⇒ Object
-
#test_parse_more_inline_config_attributes ⇒ Object
def test_parse_inline_with_thai_language text = “panel@{ :title(test) :thai(กขค) }” res = ExtParser.parse text assert_equal [ “panel”, {title: “test”, :thai => “กขค” } ], res end.
- #test_parse_only_multiple_underscored_word_value_inline_config ⇒ Object
- #test_parse_only_multiword_value_inline_config ⇒ Object
- #test_parse_only_one_inline_config ⇒ Object
- #test_parse_only_underscored_word_value_inline_config ⇒ Object
- #test_parse_xtype ⇒ Object
Instance Method Details
#test_parse_id_and_inline_config ⇒ Object
85 86 87 88 89 |
# File 'lib/test/test_parser.rb', line 85 def test_parse_id_and_inline_config text = "panel#some-id@{ :config(config) }" res = ExtParser.parse text assert_equal [ "panel", {:id => "some-id", :config => "config"}], res end |
#test_parse_id_class_and_inline_config ⇒ Object
91 92 93 94 95 |
# File 'lib/test/test_parser.rb', line 91 def test_parse_id_class_and_inline_config text = "panel#some-id.some-class@{ :config(config) }" res = ExtParser.parse text assert_equal [ "panel", {:id => "some-id", :cls => "some-class", :config => "config"}], res end |
#test_parse_inline_config_with_integer_value ⇒ Object
67 68 69 70 71 |
# File 'lib/test/test_parser.rb', line 67 def test_parse_inline_config_with_integer_value text = "panel@{ :title(test) :number(123) }" res = ExtParser.parse text assert_equal [ "panel", {title: "test", :number => 123} ], res end |
#test_parse_key_consist_classname ⇒ Object
19 20 21 22 23 |
# File 'lib/test/test_parser.rb', line 19 def test_parse_key_consist_classname classtext = "panel.class" res_classtext = ExtParser.parse(classtext) assert_equal ["panel", { :cls => "class"} ], res_classtext end |
#test_parse_key_consist_dash ⇒ Object
37 38 39 40 41 |
# File 'lib/test/test_parser.rb', line 37 def test_parse_key_consist_dash text = "panel#form-wrapper" res = ExtParser.parse text assert_equal ["panel", { :id => "form-wrapper" }], res end |
#test_parse_key_consist_id ⇒ Object
13 14 15 16 17 |
# File 'lib/test/test_parser.rb', line 13 def test_parse_key_consist_id idtext = "panel#id" res_idtext = ExtParser.parse(idtext) assert_equal ["panel", { :id => "id"} ], res_idtext end |
#test_parse_key_consist_mix_class_and_id ⇒ Object
31 32 33 34 35 |
# File 'lib/test/test_parser.rb', line 31 def test_parse_key_consist_mix_class_and_id mixtext = "panel#id.class" res = ExtParser.parse(mixtext) assert_equal ["panel", { :id => "id", :cls => "class"} ], res end |
#test_parse_key_consist_multiclass ⇒ Object
25 26 27 28 29 |
# File 'lib/test/test_parser.rb', line 25 def test_parse_key_consist_multiclass muticlass = "panel.class1-x_class2" res = ExtParser.parse(muticlass) assert_equal ["panel", { :cls => "class1-x class2"} ], res end |
#test_parse_more_inline_config_attributes ⇒ Object
def test_parse_inline_with_thai_language
text = "panel@{ :title(test) :thai(กขค) }"
res = ExtParser.parse text
assert_equal [ "panel", {title: "test", :thai => "กขค" } ], res
end
79 80 81 82 83 |
# File 'lib/test/test_parser.rb', line 79 def test_parse_more_inline_config_attributes text = "panel@{ :title(test) :text(aaa) }" res = ExtParser.parse text assert_equal [ "panel", {title: "test", text: "aaa"} ], res end |
#test_parse_only_multiple_underscored_word_value_inline_config ⇒ Object
61 62 63 64 65 |
# File 'lib/test/test_parser.rb', line 61 def test_parse_only_multiple_underscored_word_value_inline_config text = "panel@{ :title(test_test) :value(id) :number(123) }" res = ExtParser.parse text assert_equal [ "panel", {title: "test_test", value: "id", number: 123} ], res end |
#test_parse_only_multiword_value_inline_config ⇒ Object
49 50 51 52 53 |
# File 'lib/test/test_parser.rb', line 49 def test_parse_only_multiword_value_inline_config text = "panel@{ :title(test test) }" res = ExtParser.parse text assert_equal [ "panel", {title: "test test"} ], res end |
#test_parse_only_one_inline_config ⇒ Object
43 44 45 46 47 |
# File 'lib/test/test_parser.rb', line 43 def test_parse_only_one_inline_config text = "panel@{ :title(test) }" res = ExtParser.parse text assert_equal [ "panel", {title: "test"} ], res end |