Skip to content

Commit

Permalink
add two checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
CaringDev committed Apr 4, 2024
1 parent 4613abf commit 5e56471
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 361 deletions.
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@angular/platform-browser": "^17.3.0",
"@angular/platform-browser-dynamic": "^17.3.0",
"@angular/router": "^17.3.0",
"primeng": "^17.12.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"
Expand Down
340 changes: 4 additions & 336 deletions src/app/app.component.html

Large diffs are not rendered by default.

31 changes: 15 additions & 16 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ describe('AppComponent', () => {
}).compileComponents();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it(`should have the 'KatzenKlo' title`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('KatzenKlo');
});
describe('Checkbox', () => {
it('native should be disabled', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
const checkbox = compiled.querySelector('#native') as HTMLInputElement;
expect(checkbox!.disabled).toBeTrue();
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, KatzenKlo');
it('primeng should be disabled', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
const checkbox = compiled.querySelector('#primeng') as HTMLInputElement;
expect(checkbox!.disabled).toBeTrue(); // Expected false to be true.
});
});
});
16 changes: 12 additions & 4 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { FormBuilder, FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
import { CheckboxModule } from 'primeng/checkbox';

@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
imports: [CheckboxModule, ReactiveFormsModule],
templateUrl: './app.component.html',
styleUrl: './app.component.scss'
styleUrl: './app.component.scss',
})
export class AppComponent {
title = 'KatzenKlo';
readonly native = new FormControl({ value: false, disabled: true });
readonly primeng = new FormControl({ value: false, disabled: true });
readonly form = this.formBuilder.group({
native: this.native,
primeng: this.primeng,
});

constructor(readonly formBuilder: FormBuilder) {}
}
5 changes: 1 addition & 4 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [provideRouter(routes)]
providers: [],
};
3 changes: 2 additions & 1 deletion src/styles.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/* You can add global styles to this file, and also import other style files */
@import "primeng/resources/themes/lara-light-blue/theme.css";
@import "primeng/resources/primeng.css";

0 comments on commit 5e56471

Please sign in to comment.