Mailspring/spec/components/multiselect-dropdown-spec.jsx
Annie bd361c8abb refactor(signatures): Removed old signature imgs and made static empty signatures page
Summary:
Refactored signature preferences page to allow more signatures than the previous 1-1 mapping for signatures and accounts. Created a multi select dropdown of the accounts for which a certain signature is set as default for. Added a button into the draft header From field to toggle between saved signatures.

refactor(signatures): Add basic add/remove capabilities to static

refactor(signatures): Hooked up signature actions and signature store for basic functionality

fix(signatures): Cleaned up signature store and started on multiselectdropdown

fix(signatures): Add multi signature toggle select to multiselect dropdown

build(signatures): Built framework for multiselect dropdown

build(signatures): Toggle button functionality for dropdown

build(signatures): Build multi select from components and add debounce

refactor(signatures): Move signature actions and signature store into flux

fix(signatures): Styled composer signatures button/dropdown and fixed preferences checkmarks

build(signatures): Finish main functionality, about to refactor composer signature button into injected component

fix(signatures): Changed position styles

fix(signatures): Fixed background color for dropdown button when blurred

build(signatures): Began to write tests for signatures store, preferences and dropdown

Test Plan: Wrote tests for preferences signatures, signature store, signature composer dropdown and refactored tests for signature composer extension. For signature composer extension I removed applyTransformsToDraft and unapplyTransformsToDraft and tested by sending emails with signatures to different providers to make sure the <signature> tag caused problems.

Reviewers: bengotow, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3073
2016-07-11 12:35:41 -07:00

26 lines
975 B
JavaScript

import React from 'react'
import {
scryRenderedDOMComponentsWithClass,
Simulate,
} from 'react-addons-test-utils';
import MultiselectDropdown from '../../src/components/multiselect-dropdown'
import {renderIntoDocument} from '../nylas-test-utils'
const makeDropdown = (items = [], props = {}) => {
return renderIntoDocument(<MultiselectDropdown {...props} items={items} />)
}
describe('MultiselectDropdown', function multiSelectedDropdown() {
describe('_onItemClick', () => {
it('calls onToggleItem function', () => {
const onToggleItem = jasmine.createSpy('onToggleItem')
const itemChecked = jasmine.createSpy('itemChecked')
const dropdown = makeDropdown(["annie@nylas.com", "anniecook@ostby.com"], {onToggleItem, itemChecked})
dropdown.setState({selectingItems: true})
const item = scryRenderedDOMComponentsWithClass(dropdown, 'item')[0]
Simulate.mouseDown(item)
expect(onToggleItem).toHaveBeenCalled()
})
})
})