template-systems #41
@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					<div *ngIf="state != undefined">
 | 
				
			||||||
 | 
					  <div *ngIf="editedState !== state">
 | 
				
			||||||
 | 
					    <mat-icon *ngIf="initialValue">done</mat-icon>
 | 
				
			||||||
 | 
					    <mat-icon *ngIf="!initialValue">close</mat-icon>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					  <mat-checkbox *ngIf="editedState === state" [(ngModel)]="initialValue"></mat-checkbox>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { StateInitialCellComponent } from './state-initial-cell.component';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('StateInitialCellComponent', () => {
 | 
				
			||||||
 | 
					  let component: StateInitialCellComponent;
 | 
				
			||||||
 | 
					  let fixture: ComponentFixture<StateInitialCellComponent>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  beforeEach(async () => {
 | 
				
			||||||
 | 
					    await TestBed.configureTestingModule({
 | 
				
			||||||
 | 
					      imports: [StateInitialCellComponent]
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    .compileComponents();
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    fixture = TestBed.createComponent(StateInitialCellComponent);
 | 
				
			||||||
 | 
					    component = fixture.componentInstance;
 | 
				
			||||||
 | 
					    fixture.detectChanges();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  it('should create', () => {
 | 
				
			||||||
 | 
					    expect(component).toBeTruthy();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					import {Component, Input} from '@angular/core';
 | 
				
			||||||
 | 
					import {SimpleState} from "../../../../../project/game-model/gamesystems/states/SimpleState";
 | 
				
			||||||
 | 
					import {NgIf} from "@angular/common";
 | 
				
			||||||
 | 
					import {TemplateElement} from "../../../../../project/game-model/templates/TemplateElement";
 | 
				
			||||||
 | 
					import {SimpleTemplateState} from "../../../../../project/game-model/templates/simpleGamesystem/SimpleTemplateState";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Component({
 | 
				
			||||||
 | 
					  selector: 'app-state-initial-cell',
 | 
				
			||||||
 | 
					  templateUrl: './state-initial-cell.component.html',
 | 
				
			||||||
 | 
					  styleUrl: './state-initial-cell.component.scss'
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					export class StateInitialCellComponent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @Input() state: SimpleState | undefined
 | 
				
			||||||
 | 
					  @Input() editedState: SimpleState | undefined | null
 | 
				
			||||||
 | 
					  @Input() templateElement: TemplateElement | undefined
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  get initialValue(): boolean {
 | 
				
			||||||
 | 
					    if(this.templateElement != undefined && this.state instanceof SimpleTemplateState && this.state.initialMap.has(this.templateElement!)) {
 | 
				
			||||||
 | 
					      return this.state!.initialMap.get(this.templateElement!)!
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      return this.state!.initial;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  set initialValue(value: boolean) {
 | 
				
			||||||
 | 
					    if(this.templateElement != undefined && this.state instanceof SimpleTemplateState && this.state.initialMap.has(this.templateElement!)) {
 | 
				
			||||||
 | 
					      this.state.initialMap.set(this.templateElement!, value)
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      this.state!.initial = value;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user