-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Corrige docker para o windows Co-authored-by: Ricardo Loureiro <[email protected]> Co-authored-by: Geraldo Victor <[email protected]> * Adiciona componente de sugestão de pauta Co-authored-by: Ricardo Loureiro <[email protected]> Co-authored-by: Geraldo Victor <[email protected]> * Tela Sugestao de pauta Co-authored-by: VitoriaAquere <[email protected]> Co-authored-by: Diego-Carlito <[email protected]> * Adiciona service de e-mail Co-authored-by: Geraldo Victor <[email protected]> Co-authored-by: Diego-Carlito <[email protected]> * Integração do frontend com o backend Co-authored-by: Geraldo Victor <[email protected]> Co-authored-by: Diego-Carlito <[email protected]> * Descomenta código commitado por engano * Ajusta formatação e corrige requisição para endpoint do email * Corrige testes iniciais de criação de componentes Co-authored-by: VitoriaAquere <[email protected]> * Adiciona componente de participação * Adiciona rota para a página de participação * Ajustes de formatação e validação * Adiciona indicação de que o email está sendo enviado * Adiciona modulo de rotas nos testes * Adiciona teste ao frontend * Adiciona e corrige testes ao componente de sugestão de agenda * Corrige code smells * Corrige url e nome de variável --------- Co-authored-by: Diego Carlito <[email protected]> Co-authored-by: Ricardo Loureiro <[email protected]> Co-authored-by: VitoriaAquere <[email protected]>
- Loading branch information
1 parent
b874ff0
commit c6e1786
Showing
25 changed files
with
426 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export const EDUPLAY_CLIENT_KEY = "a1cdba06226408fcda63b49c50223c68d56005d234cc98bcdc1ae787d2b4de1d"; | ||
export const environment = { | ||
apiURL: 'https://unb-tv-backend-2be1ed3a0485.herokuapp.com/api', | ||
usersAPIURL: 'https://unb-tv-backend-2be1ed3a0485.herokuapp.com/api', | ||
adminAPIURL: 'https://admin-unb-tv-2023-2-dc0dd53d3aca.herokuapp.com/api' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,4 +104,5 @@ | |
color: #0087C8; | ||
margin-left: -140px; | ||
margin-top: 18.5px | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.font-unb { | ||
font-size: 13px; | ||
font-family: "unb-pro", sans-serif; | ||
} | ||
|
||
.containner h1 { | ||
color: #0087C8; | ||
font-size: 13px; | ||
font-family: "unb-pro", sans-serif; | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: 12.35px; | ||
margin-left: 29px; | ||
margin-top: 45px; | ||
margin-bottom: 40px; | ||
text-align: start; | ||
} | ||
|
||
.containner { | ||
width: 360px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
text-align: center; | ||
height: -300px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div class="containner"> | ||
<h1 [routerLink]="['/suggestAgenda']"> | ||
Sugira uma pauta | ||
</h1> | ||
<h1> | ||
Solicite uma transmissão | ||
</h1> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ParticipateComponent } from './participate.component'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
describe('ParticipateComponent', () => { | ||
let component: ParticipateComponent; | ||
let fixture: ComponentFixture<ParticipateComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ ParticipateComponent ], | ||
imports: [ RouterTestingModule ] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ParticipateComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-participate', | ||
templateUrl: './participate.component.html', | ||
styleUrls: ['./participate.component.css'] | ||
}) | ||
export class ParticipateComponent { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
.containner { | ||
width: 360px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
text-align: center; | ||
height: -300px; | ||
} | ||
|
||
.containner h1 { | ||
color: #0087C8; | ||
font-size: 13px; | ||
font-family: "unb-pro", sans-serif; | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: 12.35px; | ||
margin-left: 29px; | ||
margin-top: 45px; | ||
margin-bottom: 40px; | ||
text-align: start; | ||
} | ||
|
||
.first { | ||
border: 0.15px solid #3C3C3B; | ||
margin-left: 29px; | ||
width: 330px; | ||
border-radius: 9px; | ||
height: 30px; | ||
padding: 9px 0 10px 28px; | ||
} | ||
|
||
form ::placeholder { | ||
font-size: 13px; | ||
font-family: "unb-pro", sans-serif; | ||
} | ||
|
||
.descricao { | ||
border: 0.15px solid #3C3C3B; | ||
margin-left: 29px; | ||
width: 330px; | ||
border-radius: 9px; | ||
height: 100px; | ||
padding: 9px 0 10px 28px; | ||
} | ||
|
||
.descricao::placeholder { | ||
top: -35px; | ||
} | ||
|
||
button { | ||
background-color: #0087C8; | ||
padding: 3px 33px 3px 33px; | ||
border-radius: 9px; | ||
margin-top: 7px; | ||
} | ||
|
||
span { | ||
color: white; | ||
font-family: "unb-pro", sans-serif; | ||
font-size: 13px; | ||
} | ||
|
||
.input:focus { | ||
outline: none !important; | ||
border: 0.25px solid #00A550; | ||
} | ||
|
||
.required-field { | ||
outline: none !important; | ||
border: 2px solid red; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/app/pages/suggest-agenda/suggest-agenda.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="containner" > | ||
<div class="mb-4"> | ||
<h1>Sugestão de Pautas</h1> | ||
<form [formGroup]="suggestAgendaForm" (submit)="sendSuggestAgenda()" class="flex flex-col gap-y-3"> | ||
<input type="text" class="input first" name="tema" formControlName="tema" placeholder="Tema" > | ||
<textarea class="input descricao" name="descicao" formControlName="descricao" placeholder="Descrição" required [ngClass]="{'required-field': !isDescricaoFilled}" (change)="onRequiredFieldsChange()"></textarea> | ||
<input type="text" class="input first" name="quando" formControlName="quando" placeholder="Quando (data e hora)" > | ||
<input type="text" class="input first" name="local" formControlName="local" placeholder="Local" > | ||
<input type="text" class="input first" name="responsavel" formControlName="responsavel" placeholder="Responsável" required [ngClass]="{'required-field': !isResponsavelFilled}" (change)="onRequiredFieldsChange()"> | ||
<input type="text" class="input first" name="telefone-responsavel" formControlName="telefoneResponsavel" placeholder="Telefone do Responsável" required [ngClass]="{'required-field': !isTelefoneFilled}" (change)="onRequiredFieldsChange()"> | ||
<input type="text" class="input first" name="email-contato" formControlName="emailContato" placeholder="E-mail para contato" > | ||
<div> | ||
<button type="submit"> | ||
<span *ngIf="isSendingEmail">Enviando...</span> | ||
<span *ngIf="!isSendingEmail">Enviar</span> | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> |
89 changes: 89 additions & 0 deletions
89
src/app/pages/suggest-agenda/suggest-agenda.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; | ||
import { By } from '@angular/platform-browser'; | ||
import { of, throwError } from 'rxjs'; | ||
import { EmailService } from 'src/app/services/email.service'; | ||
import { SuggestAgendaComponent } from './suggest-agenda.component'; | ||
|
||
|
||
const mockData = "email has been sent" | ||
class EmailServiceMock { | ||
sendEmail() { | ||
return of(mockData); | ||
} | ||
} | ||
|
||
|
||
describe('SuggestAgendaComponent', () => { | ||
let component: SuggestAgendaComponent; | ||
let fixture: ComponentFixture<SuggestAgendaComponent>; | ||
let emailService: EmailService; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [SuggestAgendaComponent], | ||
imports: [HttpClientTestingModule, | ||
ReactiveFormsModule], | ||
providers: [FormBuilder, { provide: EmailService, useValue: new EmailServiceMock() }] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(SuggestAgendaComponent); | ||
component = fixture.componentInstance; | ||
emailService = TestBed.inject(EmailService); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should have a valid form on initialization', () => { | ||
fixture.detectChanges(); | ||
expect(component.suggestAgendaForm).toBeTruthy(); | ||
}); | ||
|
||
it('should call suggestAgendaComponent method when the form is submitted', () => { | ||
fixture.detectChanges(); | ||
spyOn(component, 'sendSuggestAgenda').and.callThrough(); | ||
const form = component.suggestAgendaForm; | ||
form.setValue({ descricao: 'Descrição', responsavel: 'Usuário Teste', telefoneResponsavel: '999999999', tema: '', quando: '', local: '', emailContato: '' }); | ||
|
||
const submitButton = fixture.nativeElement.querySelector( | ||
'button[type="submit"]' | ||
); | ||
submitButton.click(); | ||
|
||
expect(component.sendSuggestAgenda).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should call onRequiredFieldsChange when responsavel input value changes', () => { | ||
fixture.detectChanges(); | ||
spyOn(component, 'onRequiredFieldsChange'); | ||
|
||
const input = fixture.debugElement.query(By.css('input[name="responsavel"]')).nativeElement; | ||
input.value = 'novo valor'; | ||
input.dispatchEvent(new Event('change')); | ||
|
||
expect(component.onRequiredFieldsChange).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should call sendEmail', () => { | ||
fixture.detectChanges(); | ||
const mySpy = spyOn(emailService, 'sendEmail').and.callThrough(); | ||
const form = component.suggestAgendaForm; | ||
form.setValue({ descricao: 'Descrição', responsavel: 'Usuário Teste', telefoneResponsavel: '999999999', tema: '', quando: '', local: '', emailContato: '' }) | ||
component.sendSuggestAgenda(); | ||
expect(mySpy).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should call sendEmail and return an error', () => { | ||
fixture.detectChanges(); | ||
const mySpy = spyOn(emailService, 'sendEmail').and.returnValue(throwError(() => new Error('Erro'))); | ||
const form = component.suggestAgendaForm; | ||
form.setValue({ descricao: 'Descrição', responsavel: 'Usuário Teste', telefoneResponsavel: '999999999', tema: '', quando: '', local: '', emailContato: '' }) | ||
component.sendSuggestAgenda(); | ||
expect(mySpy).toHaveBeenCalled(); | ||
}); | ||
|
||
}); |
Oops, something went wrong.