Rafael Rinaldi é pushador de código na Netshoes, co-organizador do FEMUG-SP e co-host do ZOFE podcast. Nesta palestra, falou sobre consistência visual em projetos web.
14. .imasters {
/* Invalid color value */
color: #red;
/* Invalid property and attribute */
lorem: 'ipsum';
}
15. λ csslint style.css
csslint: There are 2 problems in style.css.
style.css
1: error at line 3, col 10
Expected a hex color but found '#red' at line 3, col 10.
color: #red;
style.css
2: warning at line 6, col 3
Unknown property 'lorem'.
lorem: 'ipsum';
20. # config.yaml
linters:
# IDs, classes and placeholders should be all lowercase.
CapitalizationInSelector:
enabled: true
# Prefer hexadecimal color codes over color keywords.
ColorKeyword:
enabled: true
# Reports when you define the same property twice.
DuplicateProperty:
enabled: true
21. λ scss-lint -c config.yaml style.css
style.css:1 Selector `iMasters` should be written in lowercase
style.css:2 Color literals like `fuchsia` should be variables
style.css:2 Color `fuchsia` should be written in hexadecimal form
style.css:3 Property `color` already defined on line 2
style.css:3 Color `fuchsia` should be written in hexadecimal form
style.css:3 Color literals like `fuchsia` should be variables
45. Feature: iMasters UI Test
As a user I want visual consistency on the http://imasters.com.br
Scenario: Header layout
Given I visit 'http://imasters.com.br'
Then 'header > logo > a' should have 'color' of 'rgb(255, 165, 0)'