blob: 4a91bc39b957245cd86497c68bf1e02ec81c2208 [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import {async, ComponentFixture, TestBed} from "@angular/core/testing";
import {TextBlockModule} from "../../text-block.module";
import {TextReplacementComponent} from "./text-replacement.component";
describe("TextReplacementComponent", () => {
let component: TextReplacementComponent;
let fixture: ComponentFixture<TextReplacementComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
TextBlockModule
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TextReplacementComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should be created", () => {
expect(component).toBeTruthy();
});
it("should emit appValueChange when the value was changed with the new set value", () => {
spyOn(component.appValueChange, "emit").and.callThrough();
component.inputValue("TestValue");
expect(component.appValueChange.emit).toHaveBeenCalledWith("TestValue");
});
it("should set appEditable to true on click on the element", () => {
component.appEditable = false;
component.onClick();
expect(component.appEditable).toBeTrue();
});
it("should set appEditable to false when input element loses focus (or date, or select)", () => {
component.appEditable = true;
component.onFocusOut();
expect(component.appEditable).toBeFalse();
});
});