Skip to content

Add tag component#30

Open
MaximDomanov wants to merge 6 commits into
developfrom
feature/tag
Open

Add tag component#30
MaximDomanov wants to merge 6 commits into
developfrom
feature/tag

Conversation

@MaximDomanov
Copy link
Copy Markdown

No description provided.

@MaximDomanov MaximDomanov added the enhancement New feature or request label Jul 21, 2020
@MaximDomanov MaximDomanov changed the title Added tag component with stories and specs Add tag component with stories and specs Jul 21, 2020
Copy link
Copy Markdown
Contributor

@feerzlay feerzlay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И помимо замечаний, еще попросил бы интерактивным ребейзом поправить текст коммита в соответствии с CONTRIBUTING, а именно:

  • use the imperative, present tense: "change" not "changed" nor "changes"
  • don't capitalize the first letter

excludeComponentDeclaration: true
});

expect(component.fixture.nativeElement.querySelector('.es-tag').style.backgroundColor).toBe(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше сделать getByTestId, это правильнее с точки зрения идеологии этой либы.
getByText > getByTestId > querySelector

expect(component.fixture.nativeElement.querySelector('.es-tag').style.backgroundColor).toBe(
'rgb(0, 0, 0)'
);
expect(component.fixture.nativeElement.querySelector('.es-tag__text').style.color).toBe(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У нас стоит расшрение https://github.com/testing-library/jest-dom и в нем помимо прочего есть toHaveStyle


&__icon {
font-size: 14px;
height: 14px !important;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо бы линтером запредить important :) Можно повышая специфичность сделать &.mat-icon {}

{
"lib": {
"entryFile": "public-api.ts",
"cssUrl": "inline"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Эта строка тут в принципе не нужна

}}
</Story>
</Preview>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужен пример с svg иконкой

@Input() icon?: string;

/**
* Override the icon displayed before the text.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может для единообразия сделать "The svg icon displayed before the text."?

@@ -0,0 +1,11 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ESTagComponent } from './tag.component';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мелкая стилистическая придирка, локальный импорт вниз переместить :)

>
{{ currentIcon.icon || '' }}
</mat-icon>
<div class="es-tag__text mat-small" [ngStyle]="{ color: textColor }">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше mat-caption, это правильное название по материалу

*/
@Input() svgIcon?: string;

get currentIcon() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавить, я в alert забыл про это

  /**
   * @internal
   * @ignore
   */

</Story>
</Preview>

We can customize element
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Точки в конце предложений, для единообразия документации.

@feerzlay feerzlay added the unapproved Pull request has some unresolved comments label Jul 27, 2020
@feerzlay feerzlay changed the title Add tag component with stories and specs Add tag component Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request unapproved Pull request has some unresolved comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants