<commit_before>// modeled after https://github.com/angular/angular/blob/cee2318110eeea115e5f6fc5bfc814cbaa7d90d8/modules/angular2/test/common/directives/ng_for_spec.ts
import { it, iit, describe, expect, inject, injectAsync, beforeEachProviders, fakeAsync, tick, TestComponentBuilder, AsyncTestCompleter } from 'angular2/testing_internal';
import {Component, ViewChild, TemplateRef} from 'angular2/core';
import * as Infragistics from '../../../src/igniteui.angular2';

export function main() {
    describe('Infragistics Angular2 Grid', () => {
		it('should initialize correctly', injectAsync([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
           var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="opts"></ig-grid></div>';
           tcb.overrideTemplate(TestComponent, template)
               .createAsync(TestComponent)
               .then((fixture) => {
					fixture.detectChanges();
					expect(fixture.debugElement.componentInstance.viewChild).toBeAnInstanceOf(Infragistics.IgGridComponent);
					async.done();
               });
         }));
		 
		 it('should initialize correctly', injectAsync([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
           var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="opts"></ig-grid></div>';
           tcb.overrideTemplate(TestComponent, template)
               .createAsync(TestComponent)
               .then((fixture) => {
					fixture.detectChanges();
					fixture.componentInstance.data[0].Name = "<NAME>";
					fixture.detectChanges();
					expect($(fixture.debugElement.nativeElement).find("#grid1 tr:first td[aria-describedby='grid1_Name']").text())
						.toBe("<NAME>");
					async.done();
               });
         }));
    });
}

@Component({
    selector: 'test-cmp',
    template: '<div></div>', //"Component 'TestComponent' must have either 'template' or 'templateUrl' set."
    directives: [Infragistics.IgGridComponent]
})
class TestComponent {
	private opts: any;
	private gridID: string;
	private data: Array<any>;
	@ViewChild(Infragistics.IgGridComponent) public viewChild: Infragistics.IgGridComponent;
	
	constructor() {
		this.gridID = "grid1";
		this.data = [
				{ "Id": 1, "Name": "<NAME>", "Age": 45 },
				{ "Id": 2, "Name": "<NAME>", "Age": 32 },
				{ "Id": 3, "Name": "<NAME>", "Age": 27 }
			]
		this.opts = {
			primaryKey: "Id",
			dataSource: this.data,
			features: [
				{ name: "Updating" }
			]
		};
	}
}<commit_msg>Add setTimeout for changeDetectionInterval to recognize changes<commit_after>// modeled after https://github.com/angular/angular/blob/cee2318110eeea115e5f6fc5bfc814cbaa7d90d8/modules/angular2/test/common/directives/ng_for_spec.ts
import { it, iit, describe, expect, inject, injectAsync, beforeEachProviders, fakeAsync, tick, TestComponentBuilder, AsyncTestCompleter } from 'angular2/testing_internal';
import {Component, ViewChild, TemplateRef} from 'angular2/core';
import * as Infragistics from '../../../src/igniteui.angular2';

export function main() {
    describe('Infragistics Angular2 Grid', () => {
		it('should initialize correctly', injectAsync([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
           var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="opts" [changeDetectionInterval]="cdi"></ig-grid></div>';
           tcb.overrideTemplate(TestComponent, template)
               .createAsync(TestComponent)
               .then((fixture) => {
					fixture.detectChanges();
					expect(fixture.debugElement.componentInstance.viewChild).toBeAnInstanceOf(Infragistics.IgGridComponent);
					async.done();
               });
         }));
		 
		 it('should initialize correctly', injectAsync([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
           var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="opts"></ig-grid></div>';
           tcb.overrideTemplate(TestComponent, template)
               .createAsync(TestComponent)
               .then((fixture) => {
					fixture.detectChanges();
					fixture.componentInstance.data[0].Name = "Mr. Smith";
					setTimeout(() => {
						fixture.detectChanges();
						expect($(fixture.debugElement.nativeElement).find("#grid1 tr:first td[aria-describedby='grid1_Name']").text())
						.toBe("Mr. Smith");
						async.done();
					}, 10);
               });
         }));
    });
}

@Component({
    selector: 'test-cmp',
    template: '<div></div>', //"Component 'TestComponent' must have either 'template' or 'templateUrl' set."
    directives: [Infragistics.IgGridComponent]
})
class TestComponent {
	private opts: any;
	private gridID: string;
	private data: Array<any>;
	private cdi: number;
	@ViewChild(Infragistics.IgGridComponent) public viewChild: Infragistics.IgGridComponent;
	
	constructor() {
		this.gridID = "grid1";
		this.cdi = 0;
		this.data = [
				{ "Id": 1, "Name": "<NAME>", "Age": 45 },
				{ "Id": 2, "Name": "<NAME>", "Age": 32 },
				{ "Id": 3, "Name": "<NAME>", "Age": 27 }
			]
		this.opts = {
			primaryKey: "Id",
			dataSource: this.data,
			features: [
				{ name: "Updating" }
			]
		};
	}
}
{'fraction_non_alphanumeric': 0.16454720616570329, 'fraction_numerical': 0.015221579961464355, 'mean_word_length': 3.6597845601436267, 'pattern_counts': {'":': 18, '<': 33, '<?xml version=': 0, '>': 44, 'https://': 2, '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': '4416210', 'n_tokens_mistral': 1781, 'n_tokens_neox': 1565, 'n_words': 300}