 
             expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0
 
-            atom.packages.activatePackage("package-with-keymaps-manifest")
-
-            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1'
-            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2'
-            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0
+            waitsForPromise ->
+              atom.packages.activatePackage("package-with-keymaps-manifest")
+
+            runs ->
+              expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1'
+              expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2'
+              expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0
 
       describe "menu loading", ->
         beforeEach ->


            expect(atom.contextMenu.templateForElement(element)).toEqual []

            atom.packages.activatePackage("package-with-menus-manifest")

            expect(atom.menu.template[0].label).toBe "Second to Last"
            expect(atom.menu.template[1].label).toBe "Last"
            expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 2"
            expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 1"
            expect(atom.contextMenu.templateForElement(element)[2]).toBeUndefined()

      describe "stylesheet loading", ->
        describe "when the metadata contains a 'stylesheets' manifest", ->

            expect(atom.themes.stylesheetElementForId(two)).toBeNull()
            expect(atom.themes.stylesheetElementForId(three)).toBeNull()

            waitsForPromise ->
              atom.packages.activatePackage("package-with-stylesheets-manifest")

            runs ->
              expect(atom.themes.stylesheetElementForId(one)).not.toBeNull()
              expect(atom.themes.stylesheetElementForId(two)).not.toBeNull()
              expect(atom.themes.stylesheetElementForId(three)).toBeNull()
              expect($('#jasmine-content').css('font-size')).toBe '1px'

        describe "when the metadata does not contain a 'stylesheets' manifest", ->
          it "loads all stylesheets from the stylesheets directory", ->
