From 3feec6a9d4f859797241f19fc0c719685def8848 Mon Sep 17 00:00:00 2001 From: shani-terminus Date: Tue, 2 Jul 2019 15:42:46 -0400 Subject: [PATCH] fix(RadioGroup): visual radios now dispatch change event ISSUES CLOSED: #1549 --- .../app/components/radio/radio.component.html | 3 + demo/app/components/radio/radio.component.ts | 6 +- .../src/radio-group.component.html | 4 +- .../src/radio-group.component.spec.ts | 95 +++++++++++++++---- .../radio-group/src/radio-group.component.ts | 25 ++--- .../radio-group/testing/src/test-helpers.ts | 2 + 6 files changed, 95 insertions(+), 40 deletions(-) diff --git a/demo/app/components/radio/radio.component.html b/demo/app/components/radio/radio.component.html index 3ec07ba37..5ce1f0776 100644 --- a/demo/app/components/radio/radio.component.html +++ b/demo/app/components/radio/radio.component.html @@ -40,6 +40,7 @@

[formatModelValueFn]="modelFormatter" [formControl]="myForm.get('myRadioGroup2')" [options]="items2$ | async" + (change)="selected($event)" > Selected value: {{ myForm.get('myRadioGroup2')?.value }} @@ -58,6 +59,7 @@

[formatModelValueFn]="modelFormatter" [formControl]="myForm.get('myRadioGroup2')" [options]="items2$ | async" + (change)="selected($event)" > Selected value: {{ myForm.get('myRadioGroup2')?.value }} @@ -76,6 +78,7 @@

[formatModelValueFn]="modelFormatter" [formControl]="myForm.get('myRadioGroup2')" [options]="items2$ | async" + (change)="selected($event)" > Selected value: {{ myForm.get('myRadioGroup2')?.value }} diff --git a/demo/app/components/radio/radio.component.ts b/demo/app/components/radio/radio.component.ts index 8de1acb94..975de5ea4 100644 --- a/demo/app/components/radio/radio.component.ts +++ b/demo/app/components/radio/radio.component.ts @@ -1,8 +1,4 @@ -import { - Component, - TemplateRef, - ViewChild, -} from '@angular/core'; +import { Component } from '@angular/core'; import { FormBuilder, FormGroup, diff --git a/terminus-ui/radio-group/src/radio-group.component.html b/terminus-ui/radio-group/src/radio-group.component.html index d60b0aed1..31a071321 100644 --- a/terminus-ui/radio-group/src/radio-group.component.html +++ b/terminus-ui/radio-group/src/radio-group.component.html @@ -15,7 +15,7 @@ [value]="retrieveValue(option, formatModelValueFn)" [disabled]="option.disabled" [name]="id" - (change)="change.emit($event)" + (change)="radioGroupChange($event)" #radio="matRadioButton" > {{ retrieveValue(option, formatUILabelFn) }} @@ -57,7 +57,7 @@