toggle star icon state when starred via cog menu in inbox

fixes CNVS-27745

test plan
- in conversations inbox, toggle starred status on a conversation
 via the cog menu
- ensure that the title of the conversation's star icon on the
 left sidebar reads "Unstar" or "Star" as appropriate. read the
 title either with a screenreader or by hovering the mouse over
 the icon

Change-Id: I4d2f2d42ff5b0d9de003e8fb3f5036a64d337504
Reviewed-on: https://gerrit.instructure.com/74066
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
This commit is contained in:
Joel Hough 2016-03-08 15:40:28 -07:00
parent d10e97ebc1
commit 33f379f7bd
2 changed files with 9 additions and 4 deletions

View File

@ -33,7 +33,7 @@ define [
@attachModel()
attachModel: ->
@model.on('change:starred', => @$starBtn.toggleClass('active'))
@model.on('change:starred', @setStarBtnChecked)
@model.on('change:workflow_state', => @$readBtn.toggleClass('read', @model.get('workflow_state') isnt 'unread'))
@model.on('change:selected', (m) => @$el.toggleClass('active', m.get('selected')))
@ -55,13 +55,17 @@ define [
deselect: (modifier) ->
@model.set('selected', false) if modifier
setStarBtnChecked: =>
@$starBtn.attr
'aria-checked': @model.starred()
title: if @model.starred() then @messages.unstar else @messages.star
@$starBtn.toggleClass('active', @model.starred())
toggleStar: (e) ->
e.preventDefault()
@model.toggleStarred()
@model.save()
@$starBtn.attr
'aria-checked': @model.starred()
title: if @model.starred() then @messages.unstar else @messages.star
@setStarBtnChecked()
toggleRead: (e) ->
e.preventDefault()

View File

@ -431,6 +431,7 @@ describe "conversations new" do
wait_for_ajaximations
click_star_toggle_menu_item
expect(f('.active', unstarred_elt)).to be_present
expect(f('.star-btn', unstarred_elt)['aria-checked']).to eq "true"
run_progress_job
expect(@conv_unstarred.reload.starred).to be_truthy
end