Comparing version 4.4.0 to 4.5.0
@@ -212,2 +212,8 @@ /*global window*/ | ||
MagicPen.prototype.isBlock = function () { | ||
return this.output.length === 1 && | ||
this.output[0].length === 1 && | ||
this.output[0][0].style === 'block'; | ||
}; | ||
MagicPen.prototype.block = function () { | ||
@@ -214,0 +220,0 @@ var pen = this.getContentFromArguments(arguments); |
@@ -525,2 +525,8 @@ /*! | ||
MagicPen.prototype.isBlock = function () { | ||
return this.output.length === 1 && | ||
this.output[0].length === 1 && | ||
this.output[0][0].style === 'block'; | ||
}; | ||
MagicPen.prototype.block = function () { | ||
@@ -527,0 +533,0 @@ var pen = this.getContentFromArguments(arguments); |
{ | ||
"name": "magicpen", | ||
"version": "4.4.0", | ||
"version": "4.5.0", | ||
"description": "Styled output in both consoles and browsers", | ||
@@ -5,0 +5,0 @@ "main": "./lib/MagicPen.js", |
@@ -300,3 +300,3 @@ # MagicPen | ||
'amend text to\n' + | ||
'it'); | ||
'it!'); | ||
``` | ||
@@ -321,3 +321,3 @@ | ||
'amend text to\n' + | ||
'it'); | ||
'it!'); | ||
``` | ||
@@ -340,3 +340,3 @@ | ||
'amend text to\n' + | ||
'it'); | ||
'it!'); | ||
``` | ||
@@ -453,2 +453,12 @@ | ||
### isBlock() | ||
Returns `true` if the output only contains a block. | ||
```js | ||
expect(magicpen().block(function () { | ||
this.text('foo'); | ||
}).isBlock(), 'to be true'); | ||
``` | ||
### installPlugin(plugin) | ||
@@ -455,0 +465,0 @@ |
@@ -1241,2 +1241,28 @@ /*global describe, it, beforeEach*/ | ||
}); | ||
describe('#isBlock', function () { | ||
it('should return false for an empty pen', function () { | ||
expect(magicpen().isBlock(), 'to be false'); | ||
}); | ||
it('should return true for a pen with only a block', function () { | ||
expect(magicpen().block(function () { | ||
this.text('foo'); | ||
}).isBlock(), 'to be true'); | ||
}); | ||
it('should return false for a pen with a block and then some', function () { | ||
expect(magicpen().block(function () { | ||
this.text('foo'); | ||
}).text(',').isBlock(), 'to be false'); | ||
}); | ||
it('should return false for a pen with two blocks', function () { | ||
expect(magicpen().block(function () { | ||
this.text('foo'); | ||
}).block(function () { | ||
this.text('bar'); | ||
}).isBlock(), 'to be false'); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
537446
3465
653