# This tests just quoted text within a contenteditable.
#
# For a test of the basic component itself see
# contenteditable-component-spec.cjsx
#
_ = require "underscore"
React = require "react"
ReactDOM = require 'react-dom'
ReactTestUtils = require('react-addons-test-utils')
Fields = require('../lib/fields').default
Composer = require("../lib/composer-view").default
ComposerEditor = require('../lib/composer-editor').default
{Message, DraftStore, ComponentRegistry} = require 'nylas-exports'
describe "Composer Quoted Text", ->
beforeEach ->
ComponentRegistry.register(ComposerEditor, role: "Composer:Editor")
@onChange = jasmine.createSpy('onChange')
@htmlNoQuote = 'Test HTML
'
@htmlWithQuote = 'Test HTML
QUOTE' @draft = new Message(draft: true, clientId: "client-123") @session = trigger: -> changes: add: jasmine.createSpy('changes.add') draft: => @draft afterEach -> DraftStore._cleanupAllSessions() ComposerEditor.containerRequired = undefined ComponentRegistry.unregister(ComposerEditor) # Must be called with the test's scope setHTML = (newHTML) -> @$contentEditable.innerHTML = newHTML @contentEditable._onDOMMutated(["mutated"]) describe "when the message is a reply", -> beforeEach -> @draft.body = @htmlNoQuote @composer = ReactTestUtils.renderIntoDocument(
QUOTE CHANGED!!!' expect(@$contentEditable.innerHTML).toBe @htmlWithQuote setHTML.call(@, newText) ev = @session.changes.add.mostRecentCall.args[0].body expect(ev).toEqual(newText) describe 'quoted text control toggle button', -> it 'should not be rendered', -> toggles = ReactTestUtils.scryRenderedDOMComponentsWithClass(@composer, 'quoted-text-control') expect(toggles.length).toBe(0)