Merge Request #29

Merged
noosfero-themes/angular-theme!29
Created by Carlos Purificação

Remove article confirmation

Assignee: Ábner Oliveira
Milestone: 2016.05

Merged by Ábner Oliveira

Commits (2)
3 participants
  • Me
    Michel Felipe @mfdeveloper

    Reassigned to @mfdeveloper

    Choose File ...   File name...
    Cancel
  • Me
    Michel Felipe started a discussion on the diff
    last updated by Carlos Purificação
    src/app/article/article-default-view-component.spec.ts
    67 69 * Execute the delete method on the target component
    68 70 */
    69 71 function doDeleteArticle() {
      72 + // Create a mock for the notification service confirmation
      73 + spyOn(helper.component.notificationService, 'confirmation').and.callFake(function (params: Function) {
    2
    • Me
      Michel Felipe @mfdeveloper

      Não seria mais indicado utilizar jasmine.createSpy("confirmation") ou jasmine.createSpyObj("notificationService", ["confirmation"]) como já está amplamente utilizado em outros testes? As diversas formas para implementar coisas muito semelhantes pode causar confusão no futuro. Chegou a conversar rapidamente com @abner sobre isso?

      Choose File ...   File name...
      Cancel
    • 2c5c4299d62769e3da7d432cd2823dd6?s=40&d=identicon
      Carlos Purificação @carloseugenio

      Não sei direito qual a diferença. Como não estava conseguindo utilizar o jasmine.createSpy, vi isto na documentação do jasmine e utilizei.

      Choose File ...   File name...
      Cancel
    Me
    Michel Felipe started a discussion on the diff
    last updated by Ábner Oliveira
    src/app/article/article-default-view.component.ts
    33 34 }
      35 + this.notificationService.success({ title: "article.remove.success.title", message: "article.remove.success.message" });
    34 36 });
    35 37 }
    36 38  
    37 39 delete() {
    38   - this.articleService.removeArticle(this.article).catch((cause: any) => {
    39   - throw new Error(`Problem removing the article: ${cause}`);
      40 + this.notificationService.confirmation({ title: "article.remove.confirmation.title", message: "article.remove.confirmation.message" }, () => {
      41 + this.doDelete();
    40 42 });
    41 43 }
    42 44  
      45 + doDelete() {
      46 + this.articleService.removeArticle(this.article).catch((cause: any) => {
      47 + throw new Error(`Problem removing the article: ${cause}`);
    3
    • Me
      Michel Felipe @mfdeveloper

      Se ocorrer um problema, essa mensagem será exibida para o usuário final?

      Choose File ...   File name...
      Cancel
    • 2c5c4299d62769e3da7d432cd2823dd6?s=40&d=identicon
      Carlos Purificação @carloseugenio

      Está conforme foi feito nos outros callbacks de serviços. Ach que tem ser feita uma revisão geral de como será o padrão de funcionamento das mensagens de erro.

      Choose File ...   File name...
      Cancel
    • 0deafa1501ec8dd687ee70f90488d592?s=40&d=identicon
      Ábner Oliveira @abner

      Como esse catch aí é num componente de tela, então deveria estar utilizando o NotificationService para exibir a mensagem de erro para o usuário. Os serviços não devem realmente tratar a exibição de mensagens, mas os componentes de tela devem.

      Choose File ...   File name...
      Cancel
    Me
    Michel Felipe started a discussion on the diff
    last updated by Michel Felipe
    src/languages/pt.json
    53 53 "article.basic_editor.cancel": "Cancelar",
    54 54 "article.basic_editor.success.title": "Bom trabalho!",
    55 55 "article.basic_editor.success.message": "Artigo salvo com sucesso!",
      56 + "article.remove.success.title": "Bom trabalho!",
    1
    • Me
      Michel Felipe @mfdeveloper

      As chaves article.remove.success.title e article.remove.confirmation.title são específicas da tela de artigo? Outras telas não relacionadas com artigo poderão utilizar essas chaves?

      Choose File ...   File name...
      Cancel
  • 0deafa1501ec8dd687ee70f90488d592?s=40&d=identicon
    Ábner Oliveira @abner

    Added 1 new commit:

    Choose File ...   File name...
    Cancel
  • 0deafa1501ec8dd687ee70f90488d592?s=40&d=identicon
    Ábner Oliveira @abner

    Reassigned to @abner

    Choose File ...   File name...
    Cancel