import { MockElement } from '../test-support'; import { InnerHTMLSink } from './inner-html-sink'; describe('InnerHTML Sink', () => { describe('Given any HTML', () => { it('sets the innerHTML on sink', () => { const el = MockElement(); const sink = InnerHTMLSink(el); const str = '
hello
'; sink(str); expect(el.innerHTML).toEqual(str); }); it('replaces existing innerHTML on sink', () => { const el = MockElement({ innerHTML: '
old text
' }); const sink = InnerHTMLSink(el); const str = '
hello
'; sink(str); expect(el.innerHTML).toEqual(str); }); }); });