/*global Headline, CmsTestUtility, expect, it, describe, PreviewHelper */

describe('HeadlineWordPressTest', function() {
    'use strict';

    CmsTestUtility.controlSetUp();

    var testData = {    content: 'Wordpress Sample'   };

    function setupThemeController(control) {
        var themeController = window.editor.themeController;
        themeController.addToControls("/controls/cartlink", control);
        window.editor.templatesController.currentTemplate.BaseTemplate.body.items.push("/controls/cartlink");
    }

    it('Html test', function() {
        var control = new Headline();
        setupThemeController(control);
        CmsTestUtility.getPreviewAfterFullExport(function(error, previewDocument) {
            var dom = $(PreviewHelper.getDataIdSelector(control.dataId), previewDocument);
            expect($('h3', dom).text().trim()).toMatch(testData.content);
            expect($('a', dom).text()).toMatch(testData.content);
        });
    });
});