Code coverage report for stylus-lint/src/checks/zIndexNormalize.js

Statements: 100% (10 / 10)      Branches: 100% (6 / 6)      Functions: 100% (2 / 2)      Lines: 100% (10 / 10)      Ignored: none     

All files » stylus-lint/src/checks/ » zIndexNormalize.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27      1 11051 1     11050     11050   40582         11050 34 29     5      
'use strict';
 
// check for z-index values that aren't normalized
module.exports = function normalizeZIndex( line ) {
    if ( typeof line !== 'string' ) {
        return;
    }
 
    var arr = line.split(/[\s\t,:]/);
 
    // remove white space
    arr = arr.filter(
        function( str ) {
            return str.length > 0;
        }
    );
 
    // the most basic of checks, throw warning if zindex value not normalized
    if ( line.indexOf( 'z-index' ) !== -1 ) {
        if ( arr[ arr.length - 1 ] % this.config.zIndexNormalize !== 0 ) {
            return true;
        }
        else {
            return false;
        }
    }
}