Mailspring/internal_packages/account-sidebar/spec/sidebar-item-spec.es6
Annie 30bb68ddd5 fix(label-nesting): maintain nested labels when renaming a label
Summary:
when renaming nested labels, maintain nested path
fixes #2402

Test Plan: created nested labels and successfully tested in dev

Reviewers: juan

Reviewed By: juan

Subscribers: evan

Differential Revision: https://phab.nylas.com/D3028
2016-06-15 16:48:26 -07:00

23 lines
963 B
JavaScript

import {Category, Actions} from "nylas-exports"
import SidebarItem from "../lib/sidebar-item"
describe("sidebar-item", function sidebarItemSpec() {
it("preserves nested labels on rename", () => {
spyOn(Actions, "queueTask")
const categories = [new Category({displayName: 'a.b/c', accountId: window.TEST_ACCOUNT_ID})]
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")
const categories = [new Category({displayName: 'a', accountId: window.TEST_ACCOUNT_ID})]
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")
})
})