spec/lib/dotremap_spec.rb in dotremap-0.0.7 vs spec/lib/dotremap_spec.rb in dotremap-0.0.8
- old
+ new
@@ -244,11 +244,11 @@
</vkopenurldef>
</root>
EOS
end
- it "accepts nested items" do
+ it "accepts group items" do
prepare_dotremap(<<-EOS)
group "Option" do
item "First" do
identifier "option.option_first"
end
@@ -273,7 +273,63 @@
<identifier>option.option_second</identifier>
</item>
</item>
</root>
EOS
+ end
+
+ context "when items are surrounded by config" do
+ it "accepts cmd combination" do
+ prepare_dotremap(<<-EOS)
+ config "Default" do
+ item "Command+A to Command+B" do
+ remap "Cmd-A", to: "Cmd-B"
+ end
+ end
+ EOS
+
+ expect_result(<<-EOS.unindent)
+ <?xml version="1.0"?>
+ <root>
+ <item>
+ <name>Command+A to Command+B</name>
+ <identifier>remap.command_a_to_command_b</identifier>
+ <autogen>__KeyToKey__ KeyCode::A, VK_COMMAND, KeyCode::B, VK_COMMAND</autogen>
+ </item>
+ </root>
+ EOS
+ end
+
+ it "accepts group items" do
+ prepare_dotremap(<<-EOS)
+ config "Original" do
+ group "Option" do
+ item "First" do
+ identifier "option.option_first"
+ end
+
+ item "Second" do
+ identifier "option.option_second"
+ end
+ end
+ end
+ EOS
+
+ expect_result(<<-EOS.unindent)
+ <?xml version="1.0"?>
+ <root>
+ <item>
+ <name>Option</name>
+ <item>
+ <name>First</name>
+ <identifier>option.option_first</identifier>
+ </item>
+ <item>
+ <name>Second</name>
+ <identifier>option.option_second</identifier>
+ </item>
+ </item>
+ </root>
+ EOS
+ end
end
end