<commit_before>﻿describe('blockEditorService tests', function () {

    var contentKey = "6A1F5BDD-67EF-4173-B061-D6348ED07094";
    var contentUdi = "umb://element/6A1F5BDD67EF4173B061D6348ED07094";
    var settingsKey = "<KEY>";
    var settingsUdi = "umb://element/2AF42343C8A2400DBA434818C2B3CDC5";

    var blockEditorService, contentResource, $rootScope, $scope, $q, localizationService, $timeout;

    beforeEach(module('umbraco.services'));
    beforeEach(module('umbraco.resources'));
    beforeEach(module('umbraco.mocks'));
    beforeEach(module('umbraco'));

    beforeEach(inject(function ($injector, mocksUtils, _$rootScope_, _$q_, _$timeout_) {

        mocksUtils.disableAuth();

        $rootScope = _$rootScope_;
        $scope = $rootScope.$new();
        $q = _$q_;
        $timeout = _$timeout_;

        contentResource = $injector.get("contentResource");
        spyOn(contentResource, "getScaffoldByKey").and.callFake(
            function () {
                var scaffold = mocksUtils.getMockVariantContent(1234, contentKey, contentUdi);
                return $q.resolve(scaffold);
            }
        );
        // this seems to be required because of the poor promise implementation in localizationService (see TODO in that service)
        localizationService = $injector.get("localizationService");
        spyOn(localizationService, "localize").and.callFake(
            function () {
                return $q.resolve("Localized test text");
            }
        );

        blockEditorService = $injector.get('blockEditorService');

    }));


    var blockConfigurationMock = { contentElementTypeKey: "<KEY>", label: "Test label", settingsElementTypeKey: null, view: "testview.html" };

    var propertyModelMock = {
        layout: {
            "Umbraco.TestBlockEditor": [
                {
                    contentUdi: contentUdi
                }
            ]
        },
        contentData: [
            {
                udi: contentUdi,
                contentTypeKey: "<KEY>",
                testproperty: "myTestValue"
            }
        ]
    };

    var blockWithSettingsConfigurationMock = { contentElementTypeKey: "<KEY>", label: "Test label", settingsElementTypeKey: "<KEY>", view: "testview.html" };
    var propertyModelWithSettingsMock = {<commit_msg>use an absolute path for test<commit_after>﻿describe('blockEditorService tests', function () {

    var contentKey = "6A1F5BDD-67EF-4173-B061-D6348ED07094";
    var contentUdi = "umb://element/6A1F5BDD67EF4173B061D6348ED07094";
    var settingsKey = "<KEY>";
    var settingsUdi = "umb://element/2AF42343C8A2400DBA434818C2B3CDC5";

    var blockEditorService, contentResource, $rootScope, $scope, $q, localizationService, $timeout;

    beforeEach(module('umbraco.services'));
    beforeEach(module('umbraco.resources'));
    beforeEach(module('umbraco.mocks'));
    beforeEach(module('umbraco'));

    beforeEach(inject(function ($injector, mocksUtils, _$rootScope_, _$q_, _$timeout_) {

        mocksUtils.disableAuth();

        $rootScope = _$rootScope_;
        $scope = $rootScope.$new();
        $q = _$q_;
        $timeout = _$timeout_;

        contentResource = $injector.get("contentResource");
        spyOn(contentResource, "getScaffoldByKey").and.callFake(
            function () {
                var scaffold = mocksUtils.getMockVariantContent(1234, contentKey, contentUdi);
                return $q.resolve(scaffold);
            }
        );
        // this seems to be required because of the poor promise implementation in localizationService (see TODO in that service)
        localizationService = $injector.get("localizationService");
        spyOn(localizationService, "localize").and.callFake(
            function () {
                return $q.resolve("Localized test text");
            }
        );

        blockEditorService = $injector.get('blockEditorService');

    }));


    var blockConfigurationMock = { contentElementTypeKey: "<KEY>", label: "Test label", settingsElementTypeKey: null, view: "/testview.html" };

    var propertyModelMock = {
        layout: {
            "Umbraco.TestBlockEditor": [
                {
                    contentUdi: contentUdi
                }
            ]
        },
        contentData: [
            {
                udi: contentUdi,
                contentTypeKey: "<KEY>",
                testproperty: "myTestValue"
            }
        ]
    };

    var blockWithSettingsConfigurationMock = { contentElementTypeKey: "<KEY>", label: "Test label", settingsElementTypeKey: "<KEY>", view: "/testview.html" };
    var propertyModelWithSettingsMock = {
{'fraction_non_alphanumeric': 0.12, 'fraction_numerical': 0.02838709677419355, 'mean_word_length': 2.544969512195122, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4743758', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1295, 'n_words': 245}