<commit_before>/// <reference path="../../typings/globals/jasmine/index.d.ts" />
import {Component} from "@angular/core";
import {PersistenceManager} from "../app/object-edit/persistence-manager";
import {Datastore} from "../app/datastore/datastore";
import {ConfigLoader} from "../app/object-edit/config-loader";
import {DocumentEditComponent} from '../../src/app/object-edit/document-edit.component';
import {EditFormComponent} from '../../src/app/object-edit/edit-form.component';
import {RelationsFormComponent} from '../../src/app/object-edit/relations-form.component';
import {RelationPickerComponent} from '../../src/app/object-edit/relation-picker.component';
import {RelationPickerGroupComponent} from '../../src/app/object-edit/relation-picker-group.component';
import {CheckboxesComponent} from '../../src/app/object-edit/forms/checkboxes.component';
import {DropdownComponent} from '../../src/app/object-edit/forms/dropdown.component';
import {InputComponent} from '../../src/app/object-edit/forms/input.component';
import {InputsComponent} from '../../src/app/object-edit/forms/inputs.component';
import {LocalizedComponent} from '../../src/app/object-edit/forms/localized.component';
import {MultiselectComponent} from '../../src/app/object-edit/forms/multiselect.component';
import {RadioComponent} from '../../src/app/object-edit/forms/radio.component';
import {TextComponent} from '../../src/app/object-edit/forms/text.component';
import {Messages} from "../app/core-services/messages";
import {TestBed, ComponentFixture} from "@angular/core/testing";
import {HttpModule} from "@angular/http";
import {FormsModule} from "@angular/forms";
import {MessagesComponent} from "../app/core-services/messages.component";


/**
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 */
export function main() {

    xdescribe('ObjectEditComponent', () => {

        class MockDatastore {}
        class MockMessages  {}

        var projectConfiguration = {
            getTypes : function() {
                return ["Section", "Feature", "Lot", "Context", "Object" ];
            },
            getFields : function() {
                return [{
                    "field": "Material",
                    "valuelist": [
                        "Alabaster",
                        "Amber",
                        "Antler"
                    ]
                }];
            }
        };

        var selectedObject = {
            "identifier": "ob1",
            "synced": 0,
            "valid": true,
            "type": "Object"
        };

        var getElementContent = function(fixture, selector: string): string[] {

            var compiled = fixture.debugElement.nativeElement;

            var labels = [];
            var nodeList = compiled.querySelectorAll(selector);

            for(var i = nodeList.length; i--;) {
                labels.push(nodeList[i].innerHTML);
            }

            return labels;
        };

        beforeEach(() => {
            TestBed.configureTestingModule({
                declarations: [
                    TestComponent,
                    DocumentEditComponent,
                    EditFormComponent,
                    RelationsFormComponent,
                    RelationPickerComponent,
                    RelationPickerGroupComponent,
                    CheckboxesComponent,
                    DropdownComponent,
                    InputComponent,
                    InputsComponent,
                    LocalizedComponent,
                    MultiselectComponent,
                    RadioComponent,
                    TextComponent,
                    MessagesComponent
                ],
                imports: [
                    HttpModule,
                    FormsModule
                ],
                providers: [
                    PersistenceManager,
                    { provide: Datastore, useClass: MockDatastore },
                    { provide: Messages, useClass: MockMessages },
                    ConfigLoader
                ]
            });
        });

        it('should build without a problem', function(done) {

            TestBed.compileComponents().then(() => {
                console.log("LOG1");

                const fixture: ComponentFixture<TestComponent> = TestBed.createComponent(TestComponent);

                console.log("LOG2");

                console.log("f0", fixture.debugElement.children[0].componentInstance)

                // fixture.detectChanges();

                console.log("f1", fixture.debugElement.children[0].componentInstance)

                fixture.debugElement.children[0].componentInstance.object = selectedObject;
                fixture.debugElement.children[0].componentInstance.projectConfiguration = projectConfiguration;

                fixture.detectChanges();

                console.log("f2", fixture.debugElement.children[0].componentInstance)

                // expect(getElementContent(fixture, 'label')).toContain('Material');
                //
                // var labels = getElementContent(fixture, 'option');<commit_msg>remove logging messages<commit_after>/// <reference path="../../typings/globals/jasmine/index.d.ts" />
import {Component} from "@angular/core";
import {PersistenceManager} from "../app/object-edit/persistence-manager";
import {Datastore} from "../app/datastore/datastore";
import {ConfigLoader} from "../app/object-edit/config-loader";
import {DocumentEditComponent} from '../../src/app/object-edit/document-edit.component';
import {EditFormComponent} from '../../src/app/object-edit/edit-form.component';
import {RelationsFormComponent} from '../../src/app/object-edit/relations-form.component';
import {RelationPickerComponent} from '../../src/app/object-edit/relation-picker.component';
import {RelationPickerGroupComponent} from '../../src/app/object-edit/relation-picker-group.component';
import {CheckboxesComponent} from '../../src/app/object-edit/forms/checkboxes.component';
import {DropdownComponent} from '../../src/app/object-edit/forms/dropdown.component';
import {InputComponent} from '../../src/app/object-edit/forms/input.component';
import {InputsComponent} from '../../src/app/object-edit/forms/inputs.component';
import {LocalizedComponent} from '../../src/app/object-edit/forms/localized.component';
import {MultiselectComponent} from '../../src/app/object-edit/forms/multiselect.component';
import {RadioComponent} from '../../src/app/object-edit/forms/radio.component';
import {TextComponent} from '../../src/app/object-edit/forms/text.component';
import {Messages} from "../app/core-services/messages";
import {TestBed, ComponentFixture} from "@angular/core/testing";
import {HttpModule} from "@angular/http";
import {FormsModule} from "@angular/forms";
import {MessagesComponent} from "../app/core-services/messages.component";


/**
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 */
export function main() {

    xdescribe('ObjectEditComponent', () => {

        class MockDatastore {}
        class MockMessages  {}

        var projectConfiguration = {
            getTypes : function() {
                return ["Section", "Feature", "Lot", "Context", "Object" ];
            },
            getFields : function() {
                return [{
                    "field": "Material",
                    "valuelist": [
                        "Alabaster",
                        "Amber",
                        "Antler"
                    ]
                }];
            }
        };

        var selectedObject = {
            "identifier": "ob1",
            "synced": 0,
            "valid": true,
            "type": "Object"
        };

        var getElementContent = function(fixture, selector: string): string[] {

            var compiled = fixture.debugElement.nativeElement;

            var labels = [];
            var nodeList = compiled.querySelectorAll(selector);

            for(var i = nodeList.length; i--;) {
                labels.push(nodeList[i].innerHTML);
            }

            return labels;
        };

        beforeEach(() => {
            TestBed.configureTestingModule({
                declarations: [
                    TestComponent,
                    DocumentEditComponent,
                    EditFormComponent,
                    RelationsFormComponent,
                    RelationPickerComponent,
                    RelationPickerGroupComponent,
                    CheckboxesComponent,
                    DropdownComponent,
                    InputComponent,
                    InputsComponent,
                    LocalizedComponent,
                    MultiselectComponent,
                    RadioComponent,
                    TextComponent,
                    MessagesComponent
                ],
                imports: [
                    HttpModule,
                    FormsModule
                ],
                providers: [
                    PersistenceManager,
                    { provide: Datastore, useClass: MockDatastore },
                    { provide: Messages, useClass: MockMessages },
                    ConfigLoader
                ]
            });
        });

        it('should build without a problem', function(done) {

            TestBed.compileComponents().then(() => {
                
                const fixture: ComponentFixture<TestComponent> = TestBed.createComponent(TestComponent);

                console.log("f0", fixture.debugElement.children[0].componentInstance)

                // fixture.detectChanges();

                console.log("f1", fixture.debugElement.children[0].componentInstance)

                fixture.debugElement.children[0].componentInstance.object = selectedObject;
                fixture.debugElement.children[0].componentInstance.projectConfiguration = projectConfiguration;

                fixture.detectChanges();

                console.log("f2", fixture.debugElement.children[0].componentInstance)

                // expect(getElementContent(fixture, 'label')).toContain('Material');
                //
                // var labels = getElementContent(fixture, 'option');
{'fraction_non_alphanumeric': 0.1293483586477217, 'fraction_numerical': 0.002155805977462028, 'mean_word_length': 1.871693866066404, 'pattern_counts': {'":': 12, '<': 15, '<?xml version=': 0, '>': 21, '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': '7543281', 'n_tokens_mistral': 2513, 'n_tokens_neox': 2394, 'n_words': 441}