completes #17 - live-coder plus text input type
Squashed commit of the following: commit d41cbf66eb2a9ee705ab60bb156eed95881fa193 Author: Mark Moser <mark.moser@perficient.com> Date: Thu Aug 4 19:58:20 2016 -0500 live-coder-text validations commit 866bfeb863516a8656bc26b10f967d0b9b8d8505 Author: Mark Moser <mark.moser@perficient.com> Date: Thu Aug 4 11:57:57 2016 -0500 getting things green again and rebasing develop commit 28a23200f291e30c690b71e9bcae3e1a69eb3093 Author: Derek Montgomery <montgomerygraphics@gmail.com> Date: Thu Aug 4 10:14:23 2016 -0500 Progress on live coder text field
This commit is contained in:
12
test/fixtures/answers.yml
vendored
12
test/fixtures/answers.yml
vendored
@ -39,7 +39,7 @@ dawn2:
|
||||
dawn3:
|
||||
candidate: dawn
|
||||
question: fed3
|
||||
answer: {html: "dawn3 <h1>I'm a little tealpot</h1>", css: 'h1 {color: teal;}', js: ''}
|
||||
answer: {html: "<h1>I'm a little tealpot</h1>", css: 'h1 {color: teal;}', js: '', text: 'I did this because reasons.'}
|
||||
saved: 0
|
||||
submitted: true
|
||||
created_at: <%= DateTime.now() - 38.hours - 50.minutes %>
|
||||
@ -75,7 +75,7 @@ dawn6:
|
||||
dawn7:
|
||||
candidate: dawn
|
||||
question: fed7
|
||||
answer: {html: 'dawn7 <p>This means <strong>jQuery</strong> needs to be available in live-coder!</p>', css: "strong {font-size: 1.6em;}\n.green {color: green;}", js: '$("strong").addClass("green");'}
|
||||
answer: {html: '<p>This means <strong>jQuery</strong> needs to be available in live-coder!</p>', css: "strong {font-size: 1.6em;}\n.green {color: green;}", js: '$("strong").addClass("green");'}
|
||||
saved: 0
|
||||
submitted: true
|
||||
created_at: <%= DateTime.now() - 38.hours - 34.minutes %>
|
||||
@ -129,7 +129,7 @@ peggy2:
|
||||
peggy3:
|
||||
candidate: peggy
|
||||
question: fed3
|
||||
answer: {html: "peggy3 <h1>I'm a little tealpot</h1>", css: 'h1 {color: teal;}', js: ''}
|
||||
answer: {html: "<h1>I'm a little tealpot</h1>", css: 'h1 {color: teal;}', js: '', text: 'I like turtles.'}
|
||||
saved: 0
|
||||
submitted: true
|
||||
created_at: <%= DateTime.now() - 38.hours - 50.minutes %>
|
||||
@ -165,7 +165,7 @@ peggy6:
|
||||
peggy7:
|
||||
candidate: peggy
|
||||
question: fed7
|
||||
answer: {html: 'peggy7 <p>This means <strong>jQuery</strong> needs to be available in live-coder!</p>', css: "strong {font-size: 1.6em;}\n.green {color: green;}", js: '$("strong").addClass("green");'}
|
||||
answer: {html: '<p>This means <strong>jQuery</strong> needs to be available in live-coder!</p>', css: "strong {font-size: 1.6em;}\n.green {color: green;}", js: '$("strong").addClass("green");'}
|
||||
saved: 0
|
||||
submitted: true
|
||||
created_at: <%= DateTime.now() - 38.hours - 34.minutes %>
|
||||
@ -220,7 +220,7 @@ richard2:
|
||||
richard3:
|
||||
candidate: richard
|
||||
question: fed3
|
||||
answer: {html: 'richard3 <h1>Salmon</h1>', css: 'h1 {color: salmon;}', js: ''}
|
||||
answer: {html: '<h1>Salmon</h1>', css: 'h1 {color: salmon;}', js: '', text: 'Gotta lotta GOOD things on sale, strangah.'}
|
||||
saved: 0
|
||||
submitted: true
|
||||
created_at: <%= DateTime.now() - 36.hours - 26.minutes %>
|
||||
@ -256,7 +256,7 @@ richard6:
|
||||
richard7:
|
||||
candidate: richard
|
||||
question: fed7
|
||||
answer: {html: 'richard7 <p>This means <strong>jQuery</strong> needs to be available in live-coder!</p>', css: "strong {font-size: 1.6em;}\n.green {color: green;}", js: '$("strong").addClass("green");'}
|
||||
answer: {html: '<p>This means <strong>jQuery</strong> needs to be available in live-coder!</p>', css: "strong {font-size: 1.6em;}\n.green {color: green;}", js: '$("strong").addClass("green");'}
|
||||
saved: 0
|
||||
submitted: true
|
||||
created_at: <%= DateTime.now() - 36.hours - 34.minutes %>
|
||||
|
2
test/fixtures/questions.yml
vendored
2
test/fixtures/questions.yml
vendored
@ -22,7 +22,7 @@ fed3:
|
||||
quiz: fed
|
||||
question: How would you create a widget that would fit in a 250px wide area as well as a 400px wide area?
|
||||
category: CSS
|
||||
input_type: live_code
|
||||
input_type: live_code_text
|
||||
input_options:
|
||||
sort: 2
|
||||
active: true
|
||||
|
@ -77,7 +77,7 @@ class AnswerFormatValidatorTest < ActiveSupport::TestCase
|
||||
obj.answer = SecureRandom.urlsafe_base64(1001)
|
||||
|
||||
refute obj.valid?
|
||||
assert_match(/char.*limit.*1000$/, obj.errors.messages[:answer][0])
|
||||
assert_match(/char.*limit.*1000.$/, obj.errors.messages[:answer][0])
|
||||
end
|
||||
|
||||
# input_type CHECK BOX
|
||||
@ -141,7 +141,7 @@ class AnswerFormatValidatorTest < ActiveSupport::TestCase
|
||||
|
||||
test "live_code should FAIL without checking finish later" do
|
||||
obj = AnswerValidatable.new('live_code')
|
||||
obj.answer = { "later" => "" }
|
||||
obj.answer = { later: "" }
|
||||
|
||||
refute obj.valid?
|
||||
assert_match(/come back/, obj.errors.messages[:answer][0])
|
||||
@ -149,9 +149,58 @@ class AnswerFormatValidatorTest < ActiveSupport::TestCase
|
||||
|
||||
test "live_code should FAIL without values" do
|
||||
obj = AnswerValidatable.new('live_code')
|
||||
obj.answer = { "later" => "", "html" => "", "css" => "", "js" => "" }
|
||||
obj.answer = { later: "", html: "", css: "", js: "" }
|
||||
|
||||
refute obj.valid?
|
||||
assert_match(/write.*code/, obj.errors.messages[:answer][0])
|
||||
end
|
||||
|
||||
# input_type LIVE CODER TEXT
|
||||
test "live_code_text should PASS with populated hash" do
|
||||
obj = AnswerValidatable.new('live_code_text')
|
||||
obj.answer = { html: 'this is html', css: '', js: '', text: 'some reasons' }
|
||||
|
||||
assert obj.valid?
|
||||
assert obj.errors.messages.empty?
|
||||
end
|
||||
|
||||
test "live_code_text should PASS with finish later" do
|
||||
obj = AnswerValidatable.new('live_code_text')
|
||||
obj.answer = { later: "true" }
|
||||
|
||||
assert obj.valid?
|
||||
assert obj.errors.messages.empty?
|
||||
end
|
||||
|
||||
test "live_code_text should FAIL with nil" do
|
||||
obj = AnswerValidatable.new('live_code_text')
|
||||
obj.answer = nil
|
||||
|
||||
refute obj.valid?
|
||||
assert_match(/write.*code/, obj.errors.messages[:answer][0])
|
||||
end
|
||||
|
||||
test "live_code_text should FAIL without checking finish later" do
|
||||
obj = AnswerValidatable.new('live_code_text')
|
||||
obj.answer = { later: "" }
|
||||
|
||||
refute obj.valid?
|
||||
assert_match(/come back/, obj.errors.messages[:answer][0])
|
||||
end
|
||||
|
||||
test "live_code_text should FAIL without values" do
|
||||
obj = AnswerValidatable.new('live_code_text')
|
||||
obj.answer = { later: "", html: "", css: "", js: "", text: "" }
|
||||
|
||||
refute obj.valid?
|
||||
assert_match(/write.*code/, obj.errors.messages[:answer][0])
|
||||
end
|
||||
|
||||
test "live_code_text should FAIL without text" do
|
||||
obj = AnswerValidatable.new('live_code_text')
|
||||
obj.answer = { later: "", html: "some html", css: "", js: "", text: "" }
|
||||
|
||||
refute obj.valid?
|
||||
assert_match(/provide.*reason/, obj.errors.messages[:answer][0])
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user