Test-proof CSS

Vittorio Vittori
Vittorio VittoriUX UI designer / Front-end engineer at ideato
Test-proof CSS
vittorio vittori
@vttrx
#css-testing
As a front-end developer
I write CSS, HTML and JavaScript
for different size projects
sometimes we start
SMALL PROJECTS
some HTML templates
mobile ready
LESS, SASS or CSS
sometimes we start
BIG PROJECTS
many templates
PHP/JS template engines
all responsive
retina support
a lot of LESS or SASS
sometimes we work on
PROJECTS THAT NEEDS HELP
huge project
no template engines
no coding standard
half working
CSS only
and
we make
MISTAKES.
we make mistakes
It’s normal
It's the main way to
grow and learn
me
excluded!
but sometimes
a small mistake
can lead to a big problem
checkout
t-shirt 8.00 $
Sport bag 22.50 $
Golf club 95.00 $
total 125.50 $
suppose a 25.000 $/day seller site
checkout
t-shirt 8.00 $
Sport bag 22.50 $
Golf club 95.00 $
total 125.50 $
Chrome render
60% of users
IE8 render
40% of users
suppose a 25.000 $/day seller site
.buy-bg {
/* background-color: #ECECEC; */
background-color: rgba(0,0,0,0.15);
}
this is a missing fallback color
rgbwhat??
your client can say goodbye to
10.000$ per day
until you fix
the missing fallback color
how can I avoid these problems
without being crazy?
CSSLINT
a tool to test CSS problems
• Possible Errors
• Disallow duplicate properties
• Disallow empty rules
• Require use of known properties, etc…
• Compatibility
• Require compatible vendor prefixes
• Require all gradient definitions
• Require fallback colors, etc…
• Performance
• Disallow units for zero values, etc…
• Maintainability & Duplication
• Disallow IDs in selectors, etc…
• Accessibility
• OOCSS
Rule types github.com/CSSLint/csslint
how it works?
CSSLINT
style.css
report
.csslintrc
CSSLINT / syntax checking
also on some text editors
jetbrains.com/phpstorm sublimetext.com
gruntjs.comnodejs.org gulpjs.com
RESEMBLEJS
a tool to test regression mistakes
how a regression test works?
image
created
image
changed
THE DIFFERENCE
the result
if the image is changed
you’ll see it
suppose a BIG WEBSITE
with tons of different widgets
needed to be reused in different places
how RESEMBLEJS works?
RESEMBLEJS
page-01.html
page-02.html
test PASSED
page-…html
fingerprints
casper
}
fingerprints
how RESEMBLEJS works?
RESEMBLEJS
…01.html
…02.html
test FAIL
…html
new images
casper
v
Sometimes
they need specific state
relative to the view for design needs
this helps you to keep
changes isolated on the page
v
regression tests should be on
static HTML templates to:
• avoid fails by fixtures changes
• get faster tests performance
• get less test writing costs
RESEMBLEJS / regression tests
gruntjs.com
nodejs.org
can be used with
phantomjs.org casperjs.org
BackstopJS gulpjs only
github.com/garris/BackstopJS
PhantomCSS
github.com/Huddle/PhantomCSSgulpjs.com
UNCSS
a tool to remove unused selectors
how it works?
UNCSS
page-01.html
page-02.html
style.uncssed.css
page-…html
style.css
CSS
.logo {
background-image: url(…);
}
.js-selector {
position: fixed;
}
div header {
background-color: pink;
}
nav {
padding: 20px;
}
HTML
<body>
<header>
<a class=“logo” href=“#”></a>
<nav>
<a href=“#”>Hello</a>
</nav>
</header>
</body>
CSS
.logo {
background-image: url(…);
}
.js-selector {
position: fixed;
}
div header {
background-color: pink;
}
nav {
padding: 20px;
}
WHITE LIST
KEPT
DELETED
KEPT
UNCSS / unused styles remover
nodejs.org
can be used with
gulpjs.comgruntjs.com
STYLESTATS
a tool to see how you wrote your styles
how it works?
STYESTATS
style.css
report
Published Wed Feb 25 2015…
Paths github.css
Stylesheets 1
Size 231.0KB
Data Uri Size 0
Rules 2957
Selectors 3289
Simplicity 89.91%
Most Identifiers 4
Most Identifiers Selector .is-uploading .avatar…
Lowest Cohesion 24
Lowest Cohesion Selector .add-line-comment
Total Unique Font Sizes 36
Unique Font Size 0.9em
…
Total Unique Colors 66
Unique Color #000
…
and so on…
STYLESTATS / unused styles remover
gruntjs.com
nodejs.org
can be used with
gulpjs.com
how I choose which tests to use?
OBJECTIVES - dev priority

Client needs, which browsers, UX needed

COMPLEXITY

Team size, tasks diversity, to-do list

BUDGET - client priority

Setup time, writing and testing time
Is that all with tests/tools?
no, there are tons of nodesjs and gruntjs plug-ins
WHAT TYPE
csslint syntax test
ResembleJS layout regression test
uncss unused selectors tool
StyleStats css stats tool
checkout http://csste.st to see more
SMALL
WHAT USE
csslint Y
ResembleJS N
uncss O
StyleStats O
less budget margins
BIG
WHAT USE
csslint Y
ResembleJS Y
uncss Y
StyleStats Y
more budget,
handle complexity,
front-end under control
Y
N
O
YES
NOT RECOMMENDED
OPTIONAL, easy to setup
VS
THANK YOU
vittorio vittori
@vttrx
#css-testing
1 of 40

Recommended

Teams, styles and scalable applications by
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applicationsVittorio Vittori
424 views75 slides
Web Design Primer Sample - HTML CSS JS by
Web Design Primer Sample - HTML CSS JSWeb Design Primer Sample - HTML CSS JS
Web Design Primer Sample - HTML CSS JSBootstrap Creative
407 views5 slides
Doing More with LESS for CSS by
Doing More with LESS for CSSDoing More with LESS for CSS
Doing More with LESS for CSSTodd Anglin
2.7K views28 slides
Modern Front-End Development by
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Developmentmwrather
8K views30 slides
Not Just a Pretty Face: How to design and build a cross-CMS CSS framework by
Not Just a Pretty Face: How to design and build a cross-CMS CSS frameworkNot Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS frameworkcrystalenka
57 views43 slides
Responsive Web Design Tutorial PDF for Beginners by
Responsive Web Design Tutorial PDF for BeginnersResponsive Web Design Tutorial PDF for Beginners
Responsive Web Design Tutorial PDF for BeginnersBootstrap Creative
1.7K views32 slides

More Related Content

What's hot

It's a Mod World - A Practical Guide to Rocking Modernizr by
It's a Mod World - A Practical Guide to Rocking ModernizrIt's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrMichael Enslow
1.9K views26 slides
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework... by
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...Cedric Spillebeen
24.2K views40 slides
The What & Why of Pattern Lab by
The What & Why of Pattern LabThe What & Why of Pattern Lab
The What & Why of Pattern LabDave Olsen
8.5K views28 slides
Lightning fast sass by
Lightning fast sassLightning fast sass
Lightning fast sasschriseppstein
4.2K views44 slides
Web Development for UX Designers by
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX DesignersAshlimarie
38.9K views92 slides
No Feature Solutions with SharePoint by
No Feature Solutions with SharePointNo Feature Solutions with SharePoint
No Feature Solutions with SharePointmikehuguet
539 views23 slides

What's hot(20)

It's a Mod World - A Practical Guide to Rocking Modernizr by Michael Enslow
It's a Mod World - A Practical Guide to Rocking ModernizrIt's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking Modernizr
Michael Enslow1.9K views
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework... by Cedric Spillebeen
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Cedric Spillebeen24.2K views
The What & Why of Pattern Lab by Dave Olsen
The What & Why of Pattern LabThe What & Why of Pattern Lab
The What & Why of Pattern Lab
Dave Olsen8.5K views
Web Development for UX Designers by Ashlimarie
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
Ashlimarie 38.9K views
No Feature Solutions with SharePoint by mikehuguet
No Feature Solutions with SharePointNo Feature Solutions with SharePoint
No Feature Solutions with SharePoint
mikehuguet539 views
Front End Development - Beyond Javascript (Robin Cannon) by Future Insights
Front End Development - Beyond Javascript (Robin Cannon)Front End Development - Beyond Javascript (Robin Cannon)
Front End Development - Beyond Javascript (Robin Cannon)
Future Insights12.6K views
Crafting Custom CSS @ PodCamp Toronto 2015 #PCTO15 by Andy McIlwain
Crafting Custom CSS @ PodCamp Toronto 2015 #PCTO15Crafting Custom CSS @ PodCamp Toronto 2015 #PCTO15
Crafting Custom CSS @ PodCamp Toronto 2015 #PCTO15
Andy McIlwain1.1K views
Drupal Theming with CSS Frameworks (960grid) by Ryan Cross
Drupal Theming with CSS Frameworks (960grid)Drupal Theming with CSS Frameworks (960grid)
Drupal Theming with CSS Frameworks (960grid)
Ryan Cross2.8K views
Refreshing Your UI with HTML5, Bootstrap and CSS3 by Matt Raible
Refreshing Your UI with HTML5, Bootstrap and CSS3Refreshing Your UI with HTML5, Bootstrap and CSS3
Refreshing Your UI with HTML5, Bootstrap and CSS3
Matt Raible38.4K views
CSS Grid Changes Everything - Keynote at WebCamp Zagreb 2017 by Morten Rand-Hendriksen
CSS Grid Changes Everything - Keynote at WebCamp Zagreb 2017CSS Grid Changes Everything - Keynote at WebCamp Zagreb 2017
CSS Grid Changes Everything - Keynote at WebCamp Zagreb 2017
Structuring your CSS for maintainability: rules and guile lines to write CSS by Sanjoy Kr. Paul
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
Sanjoy Kr. Paul77 views
Bootstrap Introduction by Andrea Tarr
Bootstrap IntroductionBootstrap Introduction
Bootstrap Introduction
Andrea Tarr3K views
CSS Lessons Learned the Hard Way (Generate Conf) by Zoe Gillenwater
CSS Lessons Learned the Hard Way (Generate Conf)CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)
Zoe Gillenwater3.1K views
Atomic design con pattern lab by UX Nights
Atomic design con pattern labAtomic design con pattern lab
Atomic design con pattern lab
UX Nights329 views
Fecrash10:3:17 sd by Thinkful
Fecrash10:3:17 sdFecrash10:3:17 sd
Fecrash10:3:17 sd
Thinkful70 views

Similar to Test-proof CSS

Using a CSS Framework by
Using a CSS FrameworkUsing a CSS Framework
Using a CSS FrameworkGareth Saunders
2.5K views102 slides
Real solutions, no tricks by
Real solutions, no tricksReal solutions, no tricks
Real solutions, no tricksJens Grochtdreis
1K views98 slides
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart by
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartExtreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartScott DeLoach
41 views2 slides
Don't sh** in the Pool by
Don't sh** in the PoolDon't sh** in the Pool
Don't sh** in the PoolChris Jean
6.7K views39 slides
Front-End Frameworks: a quick overview by
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewDiacode
15.1K views27 slides
Html5 & less css by
Html5 & less cssHtml5 & less css
Html5 & less cssGraham Johnson
755 views27 slides

Similar to Test-proof CSS(20)

Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart by Scott DeLoach
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartExtreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Scott DeLoach41 views
Don't sh** in the Pool by Chris Jean
Don't sh** in the PoolDon't sh** in the Pool
Don't sh** in the Pool
Chris Jean6.7K views
Front-End Frameworks: a quick overview by Diacode
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overview
Diacode15.1K views
Style Guides Are The New Photoshop (Smashing Conference 2012) by Stephen Hay
Style Guides Are The New Photoshop (Smashing Conference 2012)Style Guides Are The New Photoshop (Smashing Conference 2012)
Style Guides Are The New Photoshop (Smashing Conference 2012)
Stephen Hay3.9K views
Intro to mobile web application development by zonathen
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
zonathen1.3K views
State of modern web technologies: an introduction by Michael Ahearn
State of modern web technologies: an introductionState of modern web technologies: an introduction
State of modern web technologies: an introduction
Michael Ahearn624 views
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4 by Erin M. Kidwell
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Erin M. Kidwell799 views
JavaScript front end performance optimizations by Chris Love
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
Chris Love862 views
Crash Course HTML/Rails Slides by Udita Plaha
Crash Course HTML/Rails SlidesCrash Course HTML/Rails Slides
Crash Course HTML/Rails Slides
Udita Plaha3.8K views
Creating a Business Oriented UI in APEX by Enkitec
Creating a Business Oriented UI in APEXCreating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEX
Enkitec4.2K views
Style Guides Are The New Photoshop (Fronteers 2012) by Stephen Hay
Style Guides Are The New Photoshop (Fronteers 2012)Style Guides Are The New Photoshop (Fronteers 2012)
Style Guides Are The New Photoshop (Fronteers 2012)
Stephen Hay44.5K views
Mobile Monday Presentation: Responsive Web Design by Cantina
Mobile Monday Presentation: Responsive Web DesignMobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web Design
Cantina1.3K views
Death of a Themer by James Panton
Death of a ThemerDeath of a Themer
Death of a Themer
James Panton4.3K views
5 single page application principles developers need to know by Chris Love
5 single page application principles developers need to know5 single page application principles developers need to know
5 single page application principles developers need to know
Chris Love10.6K views

Recently uploaded

We see everywhere that many people are talking about technology.docx by
We see everywhere that many people are talking about technology.docxWe see everywhere that many people are talking about technology.docx
We see everywhere that many people are talking about technology.docxssuserc5935b
6 views2 slides
IGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdf by
IGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdfIGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdf
IGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdfRIPE NCC
15 views11 slides
Is Entireweb better than Google by
Is Entireweb better than GoogleIs Entireweb better than Google
Is Entireweb better than Googlesebastianthomasbejan
10 views1 slide
AI Powered event-driven translation bot by
AI Powered event-driven translation botAI Powered event-driven translation bot
AI Powered event-driven translation botJimmy Dahlqvist
16 views31 slides
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdf by
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdfOpportunities for Youth in IG - Alena Muravska RIPE NCC.pdf
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdfRIPE NCC
9 views12 slides
Existing documentaries (1).docx by
Existing documentaries (1).docxExisting documentaries (1).docx
Existing documentaries (1).docxMollyBrown86
13 views5 slides

Recently uploaded(20)

We see everywhere that many people are talking about technology.docx by ssuserc5935b
We see everywhere that many people are talking about technology.docxWe see everywhere that many people are talking about technology.docx
We see everywhere that many people are talking about technology.docx
ssuserc5935b6 views
IGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdf by RIPE NCC
IGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdfIGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdf
IGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdf
RIPE NCC15 views
AI Powered event-driven translation bot by Jimmy Dahlqvist
AI Powered event-driven translation botAI Powered event-driven translation bot
AI Powered event-driven translation bot
Jimmy Dahlqvist16 views
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdf by RIPE NCC
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdfOpportunities for Youth in IG - Alena Muravska RIPE NCC.pdf
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdf
RIPE NCC9 views
Existing documentaries (1).docx by MollyBrown86
Existing documentaries (1).docxExisting documentaries (1).docx
Existing documentaries (1).docx
MollyBrown8613 views
Building trust in our information ecosystem: who do we trust in an emergency by Tina Purnat
Building trust in our information ecosystem: who do we trust in an emergencyBuilding trust in our information ecosystem: who do we trust in an emergency
Building trust in our information ecosystem: who do we trust in an emergency
Tina Purnat85 views
Serverless cloud architecture patterns by Jimmy Dahlqvist
Serverless cloud architecture patternsServerless cloud architecture patterns
Serverless cloud architecture patterns
Jimmy Dahlqvist17 views
IETF 118: Starlink Protocol Performance by APNIC
IETF 118: Starlink Protocol PerformanceIETF 118: Starlink Protocol Performance
IETF 118: Starlink Protocol Performance
APNIC124 views
𝐒𝐨𝐥𝐚𝐫𝐖𝐢𝐧𝐝𝐬 𝐂𝐚𝐬𝐞 𝐒𝐭𝐮𝐝𝐲 by Infosec train
𝐒𝐨𝐥𝐚𝐫𝐖𝐢𝐧𝐝𝐬 𝐂𝐚𝐬𝐞 𝐒𝐭𝐮𝐝𝐲𝐒𝐨𝐥𝐚𝐫𝐖𝐢𝐧𝐝𝐬 𝐂𝐚𝐬𝐞 𝐒𝐭𝐮𝐝𝐲
𝐒𝐨𝐥𝐚𝐫𝐖𝐢𝐧𝐝𝐬 𝐂𝐚𝐬𝐞 𝐒𝐭𝐮𝐝𝐲
Infosec train7 views
PORTFOLIO 1 (Bret Michael Pepito).pdf by brejess0410
PORTFOLIO 1 (Bret Michael Pepito).pdfPORTFOLIO 1 (Bret Michael Pepito).pdf
PORTFOLIO 1 (Bret Michael Pepito).pdf
brejess04107 views
google forms survey (1).pptx by MollyBrown86
google forms survey (1).pptxgoogle forms survey (1).pptx
google forms survey (1).pptx
MollyBrown8614 views

Test-proof CSS