Sha256: 0ac679a0479a36eb5f2f97fbbe2691658044d761c55d7dced92bc5045ff8f80d

Contents?: true

Size: 651 Bytes

Versions: 4

Compression:

Stored size: 651 Bytes

Contents

var system = require('system');

var COLORS = {
  red: '\033[31m',
  green: '\033[32m',
  yellow: '\033[33m',
  gray: '\033[0;37m',
  clear: '\033[0m'
};

function colored(message, color) {
  var color = COLORS[color] || COLORS.clear;

  return color + message + COLORS.clear;
}

function output(message, color) {
  system.stdout.write(colored(message, color));
}

function textForSelector(page, selector) {
  return page.evaluate(function(selector){
    return document.querySelector(selector).textContent.replace(/\s+/mg, ' ').trim();
  }, selector);
}

module.exports = {
  colored: colored,
  output: output,
  textForSelector: textForSelector
};

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
test_squad-0.1.3 phantomjs/helpers.js
test_squad-0.1.2 phantomjs/helpers.js
test_squad-0.1.1 phantomjs/helpers.js
test_squad-0.1.0 phantomjs/helpers.js