Merge pull request #1079 from Ana06/suggest_track_color
Different colors for new tracks, types and levels
This commit is contained in:
commit
28f0973fc4
17 changed files with 91 additions and 16 deletions
|
|
@ -6,6 +6,7 @@ FactoryGirl.define do
|
|||
length 30
|
||||
minimum_abstract_length 0
|
||||
maximum_abstract_length 500
|
||||
color '#ffffff'
|
||||
program
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ feature EventType do
|
|||
within('table#event_types') do
|
||||
expect(page.has_content?('Party')).to be true
|
||||
expect(page.has_content?('13042')).to be true
|
||||
expect(page.has_content?('#e4e4e4')).to be true
|
||||
expect(page.has_content?('#E4E4E4')).to be true
|
||||
expect(page.assert_selector('tr', count: 3)).to be true
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ describe Conference do
|
|||
result = {}
|
||||
result['Hard'] = {
|
||||
'value' => 1,
|
||||
'color' => '#ffffff',
|
||||
'color' => '#FFFFFF',
|
||||
}
|
||||
result['Easy'] = {
|
||||
'value' => 2,
|
||||
|
|
@ -476,7 +476,7 @@ describe Conference do
|
|||
result = {}
|
||||
result['Hard'] = {
|
||||
'value' => 1,
|
||||
'color' => '#ffffff'
|
||||
'color' => '#FFFFFF'
|
||||
}
|
||||
result['Easy'] = {
|
||||
'value' => 1,
|
||||
|
|
@ -526,7 +526,7 @@ describe Conference do
|
|||
}
|
||||
result['Lecture'] = {
|
||||
'value' => 1,
|
||||
'color' => '#ffffff',
|
||||
'color' => '#FFFFFF',
|
||||
}
|
||||
expect(subject.event_type_distribution).to eq(result)
|
||||
end
|
||||
|
|
@ -572,7 +572,7 @@ describe Conference do
|
|||
result = {}
|
||||
result['Lecture'] = {
|
||||
'value' => 1,
|
||||
'color' => '#ffffff'
|
||||
'color' => '#FFFFFF'
|
||||
}
|
||||
result['Workshop'] = {
|
||||
'value' => 1,
|
||||
|
|
@ -622,7 +622,7 @@ describe Conference do
|
|||
}
|
||||
result['Track Two'] = {
|
||||
'value' => 1,
|
||||
'color' => '#ffffff',
|
||||
'color' => '#FFFFFF',
|
||||
}
|
||||
expect(subject.tracks_distribution).to eq(result)
|
||||
end
|
||||
|
|
@ -672,7 +672,7 @@ describe Conference do
|
|||
}
|
||||
result['Track Two'] = {
|
||||
'value' => 1,
|
||||
'color' => '#ffffff'
|
||||
'color' => '#FFFFFF'
|
||||
}
|
||||
expect(subject.tracks_distribution(:confirmed)).to eq(result)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ describe Event do
|
|||
json_hash = event.as_json(nil)
|
||||
|
||||
expect(json_hash[:room_guid]).to eq(event.room.guid)
|
||||
expect(json_hash[:track_color]).to eq('#efefef')
|
||||
expect(json_hash[:track_color]).to eq('#EFEFEF')
|
||||
expect(json_hash[:length]).to eq(30)
|
||||
end
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ describe Event do
|
|||
json_hash = event.as_json(nil)
|
||||
|
||||
expect(json_hash[:room_guid]).to be_nil
|
||||
expect(json_hash[:track_color]).to eq('#ffffff')
|
||||
expect(json_hash[:track_color]).to eq('#FFFFFF')
|
||||
expect(json_hash[:length]).to eq(25)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,6 +18,22 @@ describe EventType do
|
|||
it { is_expected.to validate_presence_of(:minimum_abstract_length) }
|
||||
it { is_expected.to validate_presence_of(:maximum_abstract_length) }
|
||||
|
||||
it 'is valid if its color is a correct hexadecimal color with 7 characters' do
|
||||
should allow_value('#FF0000').for(:color)
|
||||
end
|
||||
|
||||
it 'is not valid if its color is not a correct hexadecimal color' do
|
||||
should_not allow_value('#AB1H7G').for(:color)
|
||||
end
|
||||
|
||||
it 'is not valid if its color has less than 7 characters' do
|
||||
should_not allow_value('#fff').for(:color)
|
||||
end
|
||||
|
||||
it 'is not valid if its color has more than 7 characters' do
|
||||
should_not allow_value('#123A4567').for(:color)
|
||||
end
|
||||
|
||||
describe 'length' do
|
||||
it 'validates numericality and greater than 0' do
|
||||
is_expected.to validate_numericality_of(:length).is_greater_than(0)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ describe 'admin/difficulty_levels/index' do
|
|||
render
|
||||
expect(rendered).to include('Example Difficulty Level')
|
||||
expect(rendered).to include('Lorem Ipsum dolsum')
|
||||
expect(rendered).to include('#ffffff')
|
||||
expect(rendered).to include('#FFFFFF')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ describe 'admin/tracks/index' do
|
|||
render
|
||||
expect(rendered).to include('Example Track')
|
||||
expect(rendered).to include('Lorem Ipsum dolsum')
|
||||
expect(rendered).to include('#ffffff')
|
||||
expect(rendered).to include('#FFFFFF')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue