Skip to content

Commit 52307b2

Browse files
palita1991ma7payne
authored andcommitted
feat(plex-options): cambia button por plex-button
1 parent 7005996 commit 52307b2

4 files changed

Lines changed: 29 additions & 26 deletions

File tree

cypress/integration/template-listado.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@ context('template listado', () => {
77
});
88

99
it('test accordion', () => {
10-
cy.eyesCheckWindow('main');
11-
12-
// SE SACO PORQUE PISARON TODA UNA COMPONENTE
13-
// cy.get('plex-title').plexButtonIcon('chevron-down').click();
14-
// cy.eyesCheckWindow('modal');
15-
16-
// cy.plexButton('CANCELAR').click();
10+
cy.eyesCheckWindow('main');;
1711

1812
cy.get('plex-list plex-item').eq(0).plexButtonIcon('eye').click();
1913

2014
cy.eyesCheckWindow('item list selected');
2115

22-
cy.get('plex-options button').eq(0).click();
16+
cy.get('plex-options').plexButton('opcion 1').eq(0).click();
2317

2418
cy.eyesCheckWindow('plex-options');
2519

src/lib/css/plex-options.scss

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
plex-options {
2-
.options-container {
3-
display: flex;
4-
}
5-
6-
.option-grow {
2+
plex-button {
73
flex-grow: 1;
4+
5+
&.active {
6+
button {
7+
color: #fff;
8+
background-color: #0082ad;
9+
background-image: none;
10+
border-color: #007aa3;
11+
}
12+
}
13+
14+
button {
15+
width: 100%;
16+
}
817
}
918
}

src/lib/options/options.component.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Component, DebugElement, Type, ViewChild, ViewEncapsulation } from '@an
66
import { PlexOptionsComponent, IPlexOptionsItems } from './options.component';
77
import { PlexModule } from '../module';
88
import { FormsModule } from '@angular/forms';
9+
import { Plex } from '../core/service';
910

1011
describe('PlexOptionsComponent', () => {
1112
let fixture: ComponentFixture<PlexOptionsTestComponent>;
@@ -22,7 +23,7 @@ describe('PlexOptionsComponent', () => {
2223

2324

2425
it('have 3 buttons', fakeAsync(() => {
25-
const elements = getElementAll(fixture, 'plex-options button');
26+
const elements = getElementAll(fixture, 'plex-options plex-button');
2627
expect(elements.length).toBe(fixture.componentInstance.items.length);
2728
}));
2829

@@ -31,7 +32,7 @@ describe('PlexOptionsComponent', () => {
3132
}));
3233

3334
it('display label', fakeAsync(() => {
34-
const elements = getElementAll(fixture, 'plex-options button');
35+
const elements = getElementAll(fixture, 'plex-options plex-button');
3536

3637
elements.forEach((elem, index) => {
3738
const elementRef = elem.nativeElement;
@@ -44,7 +45,7 @@ describe('PlexOptionsComponent', () => {
4445

4546
spyOn(fixture.componentInstance, 'onChange');
4647

47-
const elements = getElementAll(fixture, 'plex-options button');
48+
const elements = getElementAll(fixture, 'plex-options plex-button');
4849
const secondButton = elements[1].nativeElement;
4950
secondButton.dispatchEvent(new Event('click'));
5051

@@ -66,7 +67,7 @@ describe('PlexOptionsComponent', () => {
6667

6768
tickAndDetectChanges(fixture);
6869

69-
const elements = getElementAll(fixture, 'plex-options button');
70+
const elements = getElementAll(fixture, 'plex-options plex-button');
7071

7172
expect(options.active).toBe('d');
7273

@@ -134,7 +135,8 @@ function createTestingModule<T>(cmp: Type<T>, template: string): ComponentFixtur
134135

135136
TestBed.configureTestingModule({
136137
imports: [BrowserModule, PlexModule, FormsModule],
137-
declarations: [cmp]
138+
declarations: [cmp],
139+
providers: [Plex]
138140
})
139141
.overrideComponent(cmp, {
140142
set: {

src/lib/options/options.component.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ export interface IPlexOptionsItems {
99
@Component({
1010
selector: 'plex-options',
1111
template: `
12-
<div class="row">
13-
<div class="d-flex col flex-wrap">
14-
<ng-container *ngFor="let item of items">
15-
<button class="btn btn-primary btn-sm option-grow m-0" (click)="onOptionsClick(item)" [class.active]="active === item.key">
16-
{{ item.label }}
17-
</button>
18-
</ng-container>
12+
<div class="row">
13+
<div class="d-flex col flex-wrap">
14+
<ng-container *ngFor="let item of items">
15+
<plex-button [type]="info" [size]="sm" [label]="item.label" (click)="onOptionsClick(item)" class="active === item.key"></plex-button>
16+
</ng-container>
17+
</div>
1918
</div>
20-
</div>
2119
`
2220
})
2321
export class PlexOptionsComponent implements OnInit, OnChanges {

0 commit comments

Comments
 (0)