Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:stypi/scribe into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Nov 14, 2013
2 parents b32f742 + 0ac6bab commit 1e63da8
Showing 1 changed file with 77 additions and 14 deletions.
91 changes: 77 additions & 14 deletions tests/webdriver/unit/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,42 +112,105 @@ def run_format_test(initial, format_delta, err_msg)
apply_delta delta, "Failed adding bold at index 0, length 3", true
end

it "should bold, then unbold highlighted text" do
it "should bold, then unbold second word of a line" do
initial = { "startLength" => 0,
"endLength" => 8,
"ops" => [{ "value" => "abc def\n"}]
}
reset_scribe initial

delta = { "startLength" => 8,
"endLength" => 8,
"ops" => [{ "start" => 4, "end" => 7, "attributes" => { "bold" => true }},
{ "start" => 7, "end" => 8 }]
}
apply_delta delta, "Failed adding bold at index 4, length 3", true

delta = { "startLength" => 8,
"endLength" => 8,
"ops" => [{ "start" => 4, "end" => 7, "attributes" => { "bold" => nil }},
{ "start" => 7, "end" => 8 }]
}
apply_delta delta, "Failed removing bold at index 4, length 3", true
end

it "should type bolded text with preemptive bold" do
initial = { "startLength" => 0,
"endLength" => 1,
"ops" => [{ "value" => "\n", "attributes" => {}}]
}

delta = { "startLength" => 1,
"endLength" => 4,
"ops" => [{ "value" => "zzz", "attributes" => { "bold" => true } },
{ "start" => 0, "end" => 1 }]}

reset_scribe initial
apply_delta delta, "Text was not bold", true
end

it "should apply a font-name format"
initial = { "startLength" => 0,
"endLength" => 4,
"ops" => [{ "value" => "abc\n"}]
}
reset_scribe initial

delta = { "startLength" => 4,
delta = { "startLength" => 4,
"endLength" => 4,
"ops" => [{ "start" => 0, "end" => 3, "attributes" => { "bold" => true }},
"ops" => [{ "start" => 0, "end" => 3, "attributes" => { "font-name" => "monospace" }},
{ "start" => 3, "end" => 4 }]
}
apply_delta delta, "Failed adding bold at index 0, length 3", true

reset_scribe initial
apply_delta delta, "Failed to apply monospace", true
end

it "should apply a font-size format"
initial = { "startLength" => 0,
"endLength" => 4,
"ops" => [{ "value" => "abc\n"}]
}

delta = { "startLength" => 4,
"endLength" => 4,
"ops" => [{ "start" => 0, "end" => 3, "attributes" => { "bold" => nil }},
"ops" => [{ "start" => 0, "end" => 3, "attributes" => { "font-size" => "huge" }},
{ "start" => 3, "end" => 4 }]
}
apply_delta delta, "Failed removing bold at index 0, length 3", true

reset_scribe initial
apply_delta delta, "Failed to apply huge font-size", true
end

it "should type bolded text with preemptive bold" do
it "should apply a fore-color"
initial = { "startLength" => 0,
"endLength" => 1,
"ops" => [{ "value" => "\n", "attributes" => {}}]
"endLength" => 4,
"ops" => [{ "value" => "abc\n"}]
}

delta = { "startLength" => 4,
"endLength" => 4,
"ops" => [{ "start" => 0, "end" => 3, "attributes" => { "fore-color" => "white" }},
{ "start" => 3, "end" => 4 }]
}

reset_scribe initial
apply_delta delta, "Failed to apply white fore-color", true
end

delta = { "startLength" => 1,
it "should apply a back-color"
initial = { "startLength" => 0,
"endLength" => 4,
"ops" => [{ "value" => "abc\n"}]
}

delta = { "startLength" => 4,
"endLength" => 4,
"ops" => [{ "value" => "zzz", "attributes" => { "bold" => true } },
{ "start" => 0, "end" => 1 }]}
"ops" => [{ "start" => 0, "end" => 3, "attributes" => { "back-color" => "black" }},
{ "start" => 3, "end" => 4 }]
}

apply_delta delta, "Text was not bold", true
reset_scribe initial
apply_delta delta, "Failed to apply black back-color", true
end
end
end

0 comments on commit 1e63da8

Please sign in to comment.