.imasters {
/* Invalid color value */
color: #red;
/* Invalid property and attribute */
lorem: 'ipsum';
}
Slide 15
Slide 15 text
λ 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';
Slide 16
Slide 16 text
Code styleguide
Slide 17
Slide 17 text
Ensure code consistency by following a set
of predefined rules
Slide 18
Slide 18 text
No content
Slide 19
Slide 19 text
SCSSLint
Slide 20
Slide 20 text
# 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
Slide 21
Slide 21 text
λ 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
Slide 22
Slide 22 text
Code architecture
Slide 23
Slide 23 text
A well structured code base make things flexible
and easier to change
Slide 24
Slide 24 text
BEM, SMACSS, OOCSS, Your Own Cool Technique…
(pick your poison)
If you have a visual styleguide,
image diff regression test can be your best friend
Slide 40
Slide 40 text
No content
Slide 41
Slide 41 text
Testing UI is more than just making assertions
against HTML markup
Slide 42
Slide 42 text
Computed style
Slide 43
Slide 43 text
Consists in testing UI by matching computed style values
Slide 44
Slide 44 text
Hardy
(uses Selenium)
Slide 45
Slide 45 text
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)'