Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added tests for [link] and quoted attributes.

Added tests for [link], [quoted="attributes"], and [single quoted='attributes'].
  • Loading branch information...
commit be88922782251adc4fe8697c7a87400928223305 1 parent f9579e6
scotthovestadt scotthovestadt authored

Showing 1 changed file with 48 additions and 4 deletions. Show diff stats Hide diff stats

  1. +48 4 tests/parse.js
52 tests/parse.js
@@ -57,9 +57,41 @@ describe('bcrypt', function() {
57 57 });
58 58 });
59 59
60   - it('should parse [url=<url>] to <a href=<url>>', function() {
61   - bbcode.parse('[url=http://example.com]url[/url]', function(parse) {
62   - parse.should.equal('<a href="http://example.com">url</a>');
  60 + describe('should parse [url] and [link]', function() {
  61 + it('should parse [url=<url>] to <a href=<url>>', function() {
  62 + bbcode.parse('[url=http://example.com]url[/url]', function(parse) {
  63 + parse.should.equal('<a href="http://example.com">url</a>');
  64 + });
  65 + });
  66 +
  67 + it('should parse [url="<url>"] to <a href=<url>>', function() {
  68 + bbcode.parse('[url="http://example.com"]url[/url]', function(parse) {
  69 + parse.should.equal('<a href="http://example.com">url</a>');
  70 + });
  71 + });
  72 +
  73 + it('should parse [url=\'<url>\'] to <a href=<url>>', function() {
  74 + bbcode.parse('[url=\'http://example.com\']url[/url]', function(parse) {
  75 + parse.should.equal('<a href="http://example.com">url</a>');
  76 + });
  77 + });
  78 +
  79 + it('should parse [link=<url>]test[/link]', function() {
  80 + bbcode.parse('[link=http://example.com]url[/link]', function(parse) {
  81 + parse.should.equal('<a href="http://example.com">url</a>');
  82 + });
  83 + });
  84 +
  85 + it('should parse [link="<url>"]test[/link]', function() {
  86 + bbcode.parse('[link="http://example.com"]url[/link]', function(parse) {
  87 + parse.should.equal('<a href="http://example.com">url</a>');
  88 + });
  89 + });
  90 +
  91 + it('should parse [link=\'<url>\']test[/link]', function() {
  92 + bbcode.parse('[link=\'http://example.com\']url[/link]', function(parse) {
  93 + parse.should.equal('<a href="http://example.com">url</a>');
  94 + });
63 95 });
64 96 });
65 97
@@ -70,6 +102,18 @@ describe('bcrypt', function() {
70 102 });
71 103 });
72 104
  105 + it('as attribute with quotes - [img="<img>"] to <img src=<img>>', function() {
  106 + bbcode.parse('[img="http://example.com/img.png"][/img]', function(parse) {
  107 + parse.should.equal('<img src="http://example.com/img.png" />');
  108 + });
  109 + });
  110 +
  111 + it('as attribute with single quotes - [img=\'<img>\'] to <img src=<img>>', function() {
  112 + bbcode.parse('[img=\'http://example.com/img.png\'][/img]', function(parse) {
  113 + parse.should.equal('<img src="http://example.com/img.png" />');
  114 + });
  115 + });
  116 +
73 117 it('as content - [img]<img>[/img] to <img src=<img>>', function() {
74 118 bbcode.parse('[img]http://example.com/img.png[/img]', function(parse) {
75 119 parse.should.equal('<img src="http://example.com/img.png" />');
@@ -141,4 +185,4 @@ describe('bcrypt', function() {
141 185 });
142 186 });
143 187 });
144   -});
  188 +});

0 comments on commit be88922

Please sign in to comment.
Something went wrong with that request. Please try again.