зеркало из https://github.com/electron/electron.git
Fix specs.
This commit is contained in:
Родитель
15d9b320db
Коммит
9b8edeb609
|
@ -68,6 +68,7 @@ Menu::insert = (pos, item) ->
|
|||
@groupsMap[item.groupId].push item
|
||||
|
||||
# Setting a radio menu item should flip other items in the group.
|
||||
v8Util.setHiddenValue item, 'checked', item.checked
|
||||
Object.defineProperty item, 'checked',
|
||||
enumerable: true
|
||||
get: -> v8Util.getHiddenValue item, 'checked'
|
||||
|
|
|
@ -36,13 +36,20 @@ describe 'menu module', ->
|
|||
]
|
||||
menu.delegate.executeCommand menu.items[0].commandId
|
||||
|
||||
describe 'radio MenuItem', ->
|
||||
it 'clicking an item should flip the checked property', ->
|
||||
menu = Menu.buildFromTemplate [ label: 'text', type: 'radio' ]
|
||||
describe 'MenuItem with checked property', ->
|
||||
it 'clicking an checkbox item should flip the checked property', ->
|
||||
menu = Menu.buildFromTemplate [ label: 'text', type: 'checkbox' ]
|
||||
assert.equal menu.items[0].checked, false
|
||||
menu.delegate.executeCommand menu.items[0].commandId
|
||||
assert.equal menu.items[0].checked, true
|
||||
|
||||
it 'clicking an radio item should always make checked property true', ->
|
||||
menu = Menu.buildFromTemplate [ label: 'text', type: 'radio' ]
|
||||
menu.delegate.executeCommand menu.items[0].commandId
|
||||
assert.equal menu.items[0].checked, true
|
||||
menu.delegate.executeCommand menu.items[0].commandId
|
||||
assert.equal menu.items[0].checked, true
|
||||
|
||||
it 'at least have one item checked in each group', ->
|
||||
template = []
|
||||
template.push label: "#{i}", type: 'radio' for i in [0..10]
|
||||
|
|
Загрузка…
Ссылка в новой задаче