Skip to content

Instantly share code, notes, and snippets.

View mseemann's full-sized avatar
🌴
On vacation

Michael Seemann mseemann

🌴
On vacation
View GitHub Profile
import {Component, EventEmitter, Input, Output, Self} from '@angular/core';
import {ControlValueAccessor, NgControl} from "@angular/forms";
import {OptionWithLabel} from "./option-with-label.interface";
@Component({
selector: 'app-select-control',
templateUrl: './select-control.component.html',
styleUrls: ['./select-control.component.scss']
})
export class SelectControlComponent<T> implements ControlValueAccessor {
<input [ngModel]="viewModel" (click)="inputClicked()" (focus)="inputFocused()" (blur)="inputBlurred()">
<div *ngIf="optionsVisible" class="options">
<div *ngFor="let option of options" (click)="optionClicked(option)" class="option-item"
[ngClass]="{active:option===selectedOption}">
{{option.label}}
</div>
</div>
import {SelectControlComponent} from './select-control.component';
describe('SelectControlComponent', () => {
let component: SelectControlComponent<unknown>;
beforeEach(async () => {
component = new SelectControlComponent<unknown>({} as any)
});
it('should create the component and have default inits', () => {
import {SelectControlComponent} from './select-control.component';
import {ComponentFixture, TestBed} from "@angular/core/testing";
import {Component, DebugElement} from "@angular/core";
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule} from "@angular/forms";
import {OptionWithLabel} from "./option-with-label.interface";
import {By} from "@angular/platform-browser";
@Component({
template: `
<form [formGroup]="form">
spring:
application:
name: leader-app
cloud:
kubernetes:
leader:
config-map-name: leader
management:
package io.mseemann.poc.k8sleaderelection;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.integration.leader.event.OnGrantedEvent;
import org.springframework.integration.leader.event.OnRevokedEvent;
import org.springframework.stereotype.Component;
@Slf4j
@Component