true 2.0.0.beta.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82b889e126441092c78fae0935640eddff42dd26
4
- data.tar.gz: 5ced6822242622c9d5b2c535a020595c4e27af45
3
+ metadata.gz: 5c0548977f5e351aeab7f465291096de0ef682ad
4
+ data.tar.gz: 00540f1f8028c954a5bd0692af85f1131b277ea9
5
5
  SHA512:
6
- metadata.gz: 5a0aefdab1acf74ad6a17293014f084f626f16d858ea61fa6b54f67ba066889c0de896d0613907d8d1e6ef26d10e74a024b7d10b395fd0e0d07642f681d46e44
7
- data.tar.gz: e170d9287c8043791a2936dd894aad9c7a3c3a1e6553e5fddb944de40df1535f1bbc0975dd704616c17dbae8d1958e18fb8d44de17817da761b7dc7ff4e83219
6
+ metadata.gz: ebd45186a8a05fa15002cecd3b98d034c7117cb48009dbf92ccd667ad03786d8557be6538eb8fcb475b17827a4eb5e3a1798b680ad6cbc453b07fb8639991a81
7
+ data.tar.gz: 55bc4bbfb19d2eaf0d4f34c140ac828ef8c87c3fc3680107a0005cc18594dba8f924dd51aa2d9a3db453d8e5ed8370dd6a7edbe7a03a2a2a2fdb64ea1f64393d
data/CHANGELOG.md CHANGED
@@ -1,15 +1,14 @@
1
1
  True Changelog
2
2
  ==============
3
3
 
4
- 2.0 (unreleased)
5
- ----------------
4
+ 2.0 (5/9/15)
5
+ ------------
6
6
  - Improve internal logic, and namespace private functions behind `_true-*`.
7
7
  - Add `assert()`, `input`, and `expect` mixins for testing CSS output.
8
8
  - Support for LibSass.
9
9
  - Add Mocha JS integration.
10
10
  — Create NPM package.
11
11
  - Simplify output options down to single `$true-terminal-output` setting.
12
- Defaults to `false` (required for libsass).
13
12
 
14
13
 
15
14
  1.0.1 (10/18/14)
data/README.md CHANGED
@@ -12,10 +12,6 @@ True
12
12
  3. To test your Sass code; debug, perfect, etc. (often using *True*):
13
13
  *True your sweet plugin before you deploy.*
14
14
 
15
- At this point
16
- True can only test values (e.g. function returns),
17
- not property/value output (e.g. mixin output).
18
-
19
15
 
20
16
  Install
21
17
  -------
@@ -28,14 +24,84 @@ gem install true
28
24
 
29
25
  # bower package
30
26
  bower install true
27
+
28
+ # npm module
29
+ npm install sass-true
30
+ ```
31
+
32
+ Usage
33
+ -----
34
+
35
+ ### In Sass
36
+
37
+ ```scss
38
+ @import "true";
39
+
40
+ @include test-module('Utilities') {
41
+
42
+ // Testing Functions
43
+ @include test('Map Add [function]') {
44
+ $base: (one: 1, two: 1, three: 1);
45
+ $add: (one: 1, two: 2, three: -1);
46
+
47
+ $test: map-add($base, $add);
48
+ $expect: (one: 2, two: 3, three: 0);
49
+ @include assert-equal($test, $expect,
50
+ 'Returns the sum of two numeric maps');
51
+ }
52
+
53
+ // Testing Mixins
54
+ @include test('Font Size [mixin]') {
55
+ @include assert('Outputs a font size and line height based on keyword.') {
56
+ @include input {
57
+ @include font-size(large);
58
+ }
59
+
60
+ @include expect {
61
+ font-size: 2rem;
62
+ line-height: 3rem;
63
+ }
64
+ }
65
+ }
66
+ }
67
+
68
+ // Optionally show summary report in CSS and/or the command line:
69
+ // - If you use Mocha, reporting to the command line is automatic.
70
+ // - if you use true-cli, report(terminal) is required for output.
71
+ @include report;
31
72
  ```
32
73
 
74
+ ### With node-sass and Mocha (or other JS test runners)
75
+
76
+ 1. Install `true` via npm (`npm install sass-true`).
77
+
78
+ 2. Write some Sass tests in `test/test.scss` (see above).
79
+
80
+ 3. Write a shim JS test file in `test/test_sass.js`:
33
81
 
34
- Command Line
35
- ------------
82
+ ```js
83
+ var path = require('path');
84
+ var true = require('sass-true');
36
85
 
37
- _This command-line tool uses Ruby
38
- and the Ruby Sass compiler._
86
+ var sassFile = path.join(__dirname, 'test.scss');
87
+ true.runSass({file: sassFile}, describe, it);
88
+ ```
89
+
90
+ 4. Run Mocha, and see your Sass tests reported as individual test results.
91
+
92
+ You can call `runSass` more than once, if you have multiple Sass test files you
93
+ want to run separately.
94
+
95
+ The first argument to `runSass` accepts the same options that node-sass'
96
+ `renderSync` function accepts. The only modification `runSass` makes is to add
97
+ True's sass path to the `includePaths` option, so `@import 'true';` works in
98
+ your Sass test file.
99
+
100
+ Any other JS test runner with equivalents to Mocha's `describe` and `it` should
101
+ be usable in the same way; just pass your test runner's `describe` and `it`
102
+ equivalents into `runSass`.
103
+
104
+ ### With ruby-sass on the command line
39
105
 
40
106
  ```bash
41
107
  true-cli [options] PATH
@@ -50,7 +116,7 @@ Config file (optional):
50
116
 
51
117
  ```yaml
52
118
  options:
53
- color: true #enables colored output
119
+ color: true # enables colored output
54
120
 
55
121
  # require ruby sass extension libraries
56
122
  require:
@@ -61,47 +127,13 @@ require:
61
127
  default location: `test/true.yml`
62
128
 
63
129
 
64
- Usage
65
- -----
66
-
67
- ```scss
68
- @import "true";
69
-
70
- @include test-module('Utilities') {
71
-
72
- @include test('Map Add [function]') {
73
- $base: (one: 1, two: 1, three: 1);
74
- $add: (one: 1, two: 2, three: -1);
75
-
76
- $test: map-add($base, $add);
77
- $expect: (one: 2, two: 3, three: 0);
78
- @include assert-equal($test, $expect,
79
- 'Returns the sum of two numeric maps');
80
- }
81
-
82
- @include test('Is Equal [function]') {
83
- $test: is-equal(1, 1rem);
84
- @include assert-equal($test, false,
85
- 'Returns false for equal numbers with different units.');
86
-
87
- $test: is-equal(1, 1);
88
- @include assert-equal($test, true,
89
- 'Returns true for numbers that are truely equal.');
90
- }
91
- }
92
-
93
- @include report;
94
- ```
95
-
96
130
  Settings
97
131
  --------
98
132
 
99
133
  There is only one setting:
100
134
  `$true-terminal-output`
101
- toggles output to the terminal on and off.
135
+ toggles output to the terminal on or off.
102
136
 
103
- - `true` will display a final summary of your test results in the terminal,
104
- and show detailed information on failing assertions.
105
- *Required for `true-cli`.*
137
+ - `true` will show detailed information on failing assertions.
138
+ This is the default, and best for using `true-cli`.
106
139
  - `false` to turn off all terminal output.
107
- *Required for Libsass.*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.beta.0
1
+ 2.0.0
data/lib/main.js CHANGED
@@ -1,5 +1,6 @@
1
1
  var _ = require('underscore');
2
2
  var parseCss = require('css').parse;
3
+ var path = require('path');
3
4
  var sass = require('node-sass');
4
5
  var CssSelectorParser = require('css-selector-parser').CssSelectorParser;
5
6
  var selectorParser = new CssSelectorParser();
@@ -10,7 +11,13 @@ var selectorParser = new CssSelectorParser();
10
11
 
11
12
  module.exports.runSass = function (options, describe, it) {
12
13
  var assert = require('assert');
13
- var css = sass.renderSync(options);
14
+ var sassPath = path.join(__dirname, '..', 'sass');
15
+ if (options.includePaths) {
16
+ options.includePaths.push(sassPath);
17
+ } else {
18
+ options.includePaths = [sassPath];
19
+ }
20
+ var css = sass.renderSync(options).css.toString();
14
21
  var modules = parse(css);
15
22
 
16
23
  _.each(modules, function (module) {
@@ -26,7 +26,7 @@ $-tnl: "\a ";
26
26
  }
27
27
 
28
28
 
29
- // Output a message to CSS, Terminal, or Comments
29
+ // Output a message to CSS comments, or command line terminal (via debug/warn)
30
30
  @mixin _true-message(
31
31
  $message,
32
32
  $output: comments
@@ -1,7 +1,7 @@
1
1
  // True Settings
2
2
  // =============
3
3
 
4
- $true-terminal-output: false !default;
4
+ $true-terminal-output: true !default;
5
5
 
6
6
 
7
7
  // Context (private)
@@ -48,30 +48,3 @@
48
48
  @return $one == $two;
49
49
  }
50
50
  }
51
-
52
-
53
- // Inspect
54
- @function _true-inspect(
55
- $value
56
- ) {
57
- @if function-exists(inspect) {
58
- @if type-of($value) == map {
59
- @return '#{inspect($value)}';
60
- } @else {
61
- @return inspect($value);
62
- }
63
- } @else if $value == null {
64
- @return 'null';
65
- } @else if type-of($value) == map {
66
- $map: '(';
67
- $keys: map-keys($value);
68
- @each $key in $keys {
69
- $val: map-get($value, $key);
70
- $last: if(index($keys, $key) == length($keys), true, false);
71
- $map: '#{$map}#{$key}: #{$val}#{if($last, ")", ", ")}';
72
- }
73
- @return $map;
74
- } @else {
75
- @return $value;
76
- }
77
- }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 'true'
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Suzanne
@@ -76,9 +76,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '>'
79
+ - - '>='
80
80
  - !ruby/object:Gem::Version
81
- version: 1.3.1
81
+ version: '1.2'
82
82
  requirements: []
83
83
  rubyforge_project: 'true'
84
84
  rubygems_version: 2.1.10