renders error when max char exceeded for outcomes title
fixes CNVS-3110 test plan: - create a new learning outcome - title must be greater than 255 chars - save learning outcome - verify presence of error dialog Change-Id: I9f91b03f5bce60dc6e7c8ddf9fdcbf1719f8adb7 Reviewed-on: https://gerrit.instructure.com/24004 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com> Product-Review: Simon Williams <simon@instructure.com> QA-Review: Amber Taniuchi <amber@instructure.com>
This commit is contained in:
parent
deb32ca36b
commit
fee20a7d89
|
@ -51,6 +51,8 @@ define [
|
|||
title: (data) ->
|
||||
if _.isEmpty data.title
|
||||
I18n.t('blank_error', 'Cannot be blank')
|
||||
else if data.title.length > 255
|
||||
I18n.t('length_error', 'Must be 255 characters or less')
|
||||
|
||||
# Returns true if there are no errors in @validations.
|
||||
# Also creates an @errors object for use in @showErrors()
|
||||
|
|
|
@ -25,6 +25,7 @@ class LearningOutcome < ActiveRecord::Base
|
|||
serialize :data
|
||||
before_save :infer_defaults
|
||||
validates_length_of :description, :maximum => maximum_text_length, :allow_nil => true, :allow_blank => true
|
||||
validates_length_of :short_description, :maximum => maximum_string_length
|
||||
validates_presence_of :short_description
|
||||
sanitize_field :description, Instructure::SanitizeField::SANITIZE
|
||||
|
||||
|
|
|
@ -243,6 +243,28 @@ def should_validate_mastery_points
|
|||
f('.error_box').should be_present
|
||||
end
|
||||
|
||||
def should_validate_short_description_presence
|
||||
get outcome_url
|
||||
wait_for_ajaximations
|
||||
f('.add_outcome_link').click
|
||||
# Submit outcome with an empty title
|
||||
f('.outcome_title').clear
|
||||
f('.submit_button').click
|
||||
wait_for_ajaximations
|
||||
fj('.error_text div').text.should == "Cannot be blank"
|
||||
end
|
||||
|
||||
def should_validate_short_description_length
|
||||
get outcome_url
|
||||
wait_for_ajaximations
|
||||
f('.add_outcome_link').click
|
||||
content = ('Wee taco banana hello 255 characters exceeded' * 10)
|
||||
replace_content f('.outcome_title'), (content)
|
||||
f('.submit_button').click
|
||||
wait_for_ajaximations
|
||||
fj('.error_text').should be_present
|
||||
end
|
||||
|
||||
def should_create_an_outcome_group_root_level
|
||||
get outcome_url
|
||||
wait_for_ajaximations
|
||||
|
|
|
@ -31,6 +31,14 @@ describe "outcomes" do
|
|||
it "should validate mastery points" do
|
||||
should_validate_mastery_points
|
||||
end
|
||||
|
||||
it "should require a title" do
|
||||
should_validate_short_description_presence
|
||||
end
|
||||
|
||||
it "should require a title less than 255 chars" do
|
||||
should_validate_short_description_length
|
||||
end
|
||||
end
|
||||
|
||||
context "create/edit/delete outcome groups" do
|
||||
|
|
Loading…
Reference in New Issue