Add spec for uninstalling a package

This commit is contained in:
Kevin Sawicki 2013-05-22 14:22:43 -07:00
parent 26bfd95289
commit 23ce97a358

View File

@ -22,9 +22,15 @@ describe "PackageConfigPanel", ->
version: '5.8.5'
}
]
spyOn(packageManager, 'getAvailable').andCallFake (callback) ->
callback(null, packages)
spyOn(packageManager, 'uninstall').andCallFake (pack, callback) ->
callback()
spyOn(atom, 'getAvailablePackageMetadata').andReturn(packages)
spyOn(atom, 'resolvePackagePath').andCallFake (name) ->
"/tmp/atom-packages/#{name}"
configObserver = jasmine.createSpy("configObserver")
observeSubscription = config.observe('core.disabledPackages', configObserver)
@ -75,6 +81,14 @@ describe "PackageConfigPanel", ->
p3View.enableToggle.find('a').click()
expect(configObserver).toHaveBeenCalledWith(['p1'])
describe "when Uninstall is clicked", ->
it "removes the package from the tab", ->
expect(panel.installed.find("[name='p1']")).toExist()
p1View = panel.installed.find("[name='p1']").view()
expect(p1View.defaultAction.text()).toBe 'Uninstall'
p1View.defaultAction.click()
expect(panel.installed.find("[name='p1']")).not.toExist()
describe 'Available tab', ->
it 'lists all available packages', ->
panel.availableLink.click()