This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .foo { | |
| color: red; | |
| } | |
| .bar { | |
| color: red; | |
| } | |
| @media all and (min-width: 768px) { | |
| .foo { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| language: node_js | |
| node_js: | |
| - node # latest node.js version | |
| install: | |
| - npm install # can be not specified, runs by default | |
| before_script: | |
| - npm start & # start local server, '&' means use it as parallel process | |
| - sleep 5 # 5s to make sure that local server have enough time to up | |
| script: | |
| - npm test # can be not specified, runs by default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "casper-travis", | |
| "version": "0.0.1", | |
| "description": "Functional tests with Casper.js in Travis CI", | |
| "main": "index.html", | |
| "scripts": { | |
| "preinstall": "npm i -g http-server casperjs", | |
| "start": "http-server", | |
| "test": "casperjs test tests/" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <button class="action" type="button">Click me</button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.querySelector('.action').addEventListener('click', function () { | |
| this.insertAdjacentHTML('afterend', '<div class="text">You hear \'click\'</div>'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| casper.test.begin('Testing index page', 1, function (test) { | |
| casper | |
| .start('http://localhost:8080') | |
| .then(function () { | |
| this.echo('Text appearing', 'COMMENT'); | |
| this.click('.action'); | |
| test.assertExists('.text', 'Text is appearing after click'); | |
| }) | |
| .run(function () { | |
| test.done() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| test: /\.(jpg|png|svg)$/, | |
| type: 'asset/resource', | |
| include: './path/to/images' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const pathToCat = require('./path/to/cats/grumpy-cat.png'); | |
| const getCat = () => `<img src='${pathToCat}' alt='Grumpy Cat' />`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const cats = [ | |
| 'black-cat.png', | |
| 'white-cat.png', | |
| 'grumpy-cat.png', | |
| 'rainbow-cat.png' | |
| ]; | |
| const getCats = () => cats.map(name => `<img src='./path/to/cats/${name}' alt='${name}' />`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const pathToCats = require.context('./path/to/cats', true); | |
| // true here is for use subdirectories, you can also specify regex as third param | |
| const cats = [ | |
| 'black-cat.png', | |
| 'white-cat.png', | |
| 'grumpy-cat.png', | |
| 'rainbow-cat.png' | |
| ]; |