/* global
 describe, it, beforeEach, assert, expect, PreviewHelper,
 Text404, CmsTestUtility
*/
describe('Text404 control for WordPress', function() {
    'use strict';
    var control, themeController;

    var data = {
        'caption': "Not Found",
        'text': "Apologies, but the page you requested could not be found. Perhaps searching will help."
    };

    CmsTestUtility.controlSetUp();

    beforeEach(function () {
        themeController = window.editor.themeController;
        control = new Text404();
    });

    it('html test', function() {
        themeController.addToControls("/controls/Text404", control);
        window.editor.templatesController.currentTemplate.BaseTemplate.body.items.push("/controls/Text404");
        CmsTestUtility.getPreviewAfterFullExport(function(error, previewDocument) {
            var dom = $(PreviewHelper.getDataIdSelector(control.Container.dataId), previewDocument);
            assert(dom.length === 1, "control not found");
            expect(dom.children().length).toBeGreaterThan(0);
            expect(data.caption).toEqual(dom.find('h4').html());
            expect(data.text).toEqual(dom.find('p').html());
        });
    });

});

