2017-06-29 14:48:45 +08:00
|
|
|
import {Folder, Actions} from "nylas-exports"
|
2016-06-16 07:46:34 +08:00
|
|
|
import SidebarItem from "../lib/sidebar-item"
|
|
|
|
|
|
|
|
describe("sidebar-item", function sidebarItemSpec() {
|
|
|
|
it("preserves nested labels on rename", () => {
|
|
|
|
spyOn(Actions, "queueTask")
|
2017-06-29 14:48:45 +08:00
|
|
|
const categories = [new Folder({displayName: 'a.b/c', accountId: window.TEST_ACCOUNT_ID})]
|
2016-06-16 07:46:34 +08:00
|
|
|
NylasEnv.savedState.sidebarKeysCollapsed = {}
|
|
|
|
const item = SidebarItem.forCategories(categories)
|
|
|
|
item.onEdited(item, 'd')
|
|
|
|
const task = Actions.queueTask.calls[0].args[0]
|
|
|
|
expect(task.displayName).toBe("a.b/d")
|
|
|
|
})
|
|
|
|
it("preserves labels on rename", () => {
|
|
|
|
spyOn(Actions, "queueTask")
|
2017-06-29 14:48:45 +08:00
|
|
|
const categories = [new Folder({displayName: 'a', accountId: window.TEST_ACCOUNT_ID})]
|
2016-06-16 07:46:34 +08:00
|
|
|
NylasEnv.savedState.sidebarKeysCollapsed = {}
|
|
|
|
const item = SidebarItem.forCategories(categories)
|
|
|
|
item.onEdited(item, 'b')
|
|
|
|
const task = Actions.queueTask.calls[0].args[0]
|
|
|
|
expect(task.displayName).toBe("b")
|
|
|
|
})
|
|
|
|
})
|