Class: ExtParserTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/test/test_parser.rb

Instance Method Summary collapse

Instance Method Details

#test_parse_id_and_inline_configObject



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_configObject



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_valueObject



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_classnameObject



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_dashObject



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_idObject



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_idObject



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_multiclassObject



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_attributesObject

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_configObject



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_configObject



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_configObject



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

#test_parse_only_underscored_word_value_inline_configObject



55
56
57
58
59
# File 'lib/test/test_parser.rb', line 55

def test_parse_only_underscored_word_value_inline_config
  text = "panel@{ :title(test_test) }" 
  res = ExtParser.parse text
  assert_equal [ "panel", {title: "test_test"} ], res
end

#test_parse_xtypeObject



7
8
9
10
11
# File 'lib/test/test_parser.rb', line 7

def test_parse_xtype
  text = "panel"   
  res = ExtParser.parse(text)
  assert_equal [ "panel", {} ], res
end