Преглед на файлове

Changed wording of some specs

tags/0.7.0
Michael Jackson преди 13 години
родител
ревизия
afc6e0f1b1
променени са 2 файла, в които са добавени 23 реда и са изтрити 23 реда
  1. +8
    -8
      test/context_test.js
  2. +15
    -15
      test/scanner_test.js

+ 8
- 8
test/context_test.js Целия файл

@@ -9,10 +9,10 @@ vows.describe("Mustache.Context").addBatch({
var context = new Context(view); var context = new Context(view);
return context; return context;
}, },
"should be able to lookup properties of its own view": function (context) {
"is able to lookup properties of its own view": function (context) {
assert.equal(context.lookup("name"), "parent"); assert.equal(context.lookup("name"), "parent");
}, },
"should be able to lookup nested properties of its own view": function (context) {
"is able to lookup nested properties of its own view": function (context) {
assert.equal(context.lookup("a.b"), "b"); assert.equal(context.lookup("a.b"), "b");
}, },
"when pushed": { "when pushed": {
@@ -20,26 +20,26 @@ vows.describe("Mustache.Context").addBatch({
var view = { name: 'child', c: { d: 'd' } }; var view = { name: 'child', c: { d: 'd' } };
return context.push(view); return context.push(view);
}, },
"should return the child context": function (context) {
"returns the child context": function (context) {
assert.equal(context.view.name, "child"); assert.equal(context.view.name, "child");
assert.equal(context.parent.view.name, "parent"); assert.equal(context.parent.view.name, "parent");
}, },
"should be able to lookup properties of its own view": function (context) {
"is able to lookup properties of its own view": function (context) {
assert.equal(context.lookup("name"), "child"); assert.equal(context.lookup("name"), "child");
}, },
"should be able to lookup properties of the parent context's view": function (context) {
"is able to lookup properties of the parent context's view": function (context) {
assert.equal(context.lookup("message"), "hi"); assert.equal(context.lookup("message"), "hi");
}, },
"should be able to lookup nested properties of its own view": function (context) {
"is able to lookup nested properties of its own view": function (context) {
assert.equal(context.lookup("c.d"), "d"); assert.equal(context.lookup("c.d"), "d");
}, },
"should be able to lookup nested properties of its parent view": function (context) {
"is able to lookup nested properties of its parent view": function (context) {
assert.equal(context.lookup("a.b"), "b"); assert.equal(context.lookup("a.b"), "b");
} }
} // when pushed } // when pushed
}, // A Context }, // A Context
"make": { "make": {
"should return the same object when given a Context": function () {
"returns the same object when given a Context": function () {
var context = new Context; var context = new Context;
assert.strictEqual(Context.make(context), context); assert.strictEqual(Context.make(context), context);
} }


+ 15
- 15
test/scanner_test.js Целия файл

@@ -6,7 +6,7 @@ vows.describe("Mustache.Scanner").addBatch({
"A Scanner": { "A Scanner": {
"for an empty string": { "for an empty string": {
topic: new Scanner(""), topic: new Scanner(""),
"should be at the end of the string": function () {
"is at the end of the string": function () {
var scanner = new Scanner(""); var scanner = new Scanner("");
assert(scanner.eos()); assert(scanner.eos());
} }
@@ -20,10 +20,10 @@ vows.describe("Mustache.Scanner").addBatch({
var match = scanner.scan(/a b c/); var match = scanner.scan(/a b c/);
this.callback(scanner, match); this.callback(scanner, match);
}, },
"it should return the entire string": function (scanner, match) {
"returns the entire string": function (scanner, match) {
assert.equal(match, scanner.string); assert.equal(match, scanner.string);
}, },
"it should be at the end of the string": function (scanner, match) {
"is at the end of the string": function (scanner, match) {
assert(scanner.eos()); assert(scanner.eos());
} }
}, // when the regexp matches the entire string }, // when the regexp matches the entire string
@@ -34,10 +34,10 @@ vows.describe("Mustache.Scanner").addBatch({
var match = scanner.scan(/a/); var match = scanner.scan(/a/);
this.callback(scanner, match); this.callback(scanner, match);
}, },
"it should return the portion of the string that was matched": function (scanner, match) {
"returns the portion of the string that was matched": function (scanner, match) {
assert.equal(match, "a"); assert.equal(match, "a");
}, },
"it should advance the internal pointer the length of the match": function (scanner, match) {
"advances the internal pointer the length of the match": function (scanner, match) {
assert.equal(scanner.pos, 1); assert.equal(scanner.pos, 1);
} }
}, // at the 0th index }, // at the 0th index
@@ -47,10 +47,10 @@ vows.describe("Mustache.Scanner").addBatch({
var match = scanner.scan(/b/); var match = scanner.scan(/b/);
this.callback(scanner, match); this.callback(scanner, match);
}, },
"it should return the empty string": function (scanner, match) {
"returns the empty string": function (scanner, match) {
assert.equal(match, ""); assert.equal(match, "");
}, },
"it should not advance the internal pointer": function (scanner, match) {
"does not advance the internal pointer": function (scanner, match) {
assert.equal(scanner.pos, 0); assert.equal(scanner.pos, 0);
} }
} // at some index other than 0 } // at some index other than 0
@@ -61,10 +61,10 @@ vows.describe("Mustache.Scanner").addBatch({
var match = scanner.scan(/z/); var match = scanner.scan(/z/);
this.callback(scanner, match); this.callback(scanner, match);
}, },
"it should return the empty string": function (scanner, match) {
"returns the empty string": function (scanner, match) {
assert.equal(match, ""); assert.equal(match, "");
}, },
"it should not advance the internal pointer": function (scanner, match) {
"does not advance the internal pointer": function (scanner, match) {
assert.equal(scanner.pos, 0); assert.equal(scanner.pos, 0);
} }
} }
@@ -77,10 +77,10 @@ vows.describe("Mustache.Scanner").addBatch({
var match = scanner.scanUntil(/a/); var match = scanner.scanUntil(/a/);
this.callback(scanner, match); this.callback(scanner, match);
}, },
"it should return the empty string": function (scanner, match) {
"returns the empty string": function (scanner, match) {
assert.equal(match, "") assert.equal(match, "")
}, },
"it should not advance the internal pointer": function (scanner, match) {
"does not advance the internal pointer": function (scanner, match) {
assert.equal(scanner.pos, 0); assert.equal(scanner.pos, 0);
} }
}, },
@@ -90,10 +90,10 @@ vows.describe("Mustache.Scanner").addBatch({
var match = scanner.scanUntil(/b/); var match = scanner.scanUntil(/b/);
this.callback(scanner, match); this.callback(scanner, match);
}, },
"it should return the portion of the string it scanned": function (scanner, match) {
"returns the portion of the string it scanned": function (scanner, match) {
assert.equal(match, "a "); assert.equal(match, "a ");
}, },
"it should advance the internal pointer the length of the match": function (scanner, match) {
"advances the internal pointer the length of the match": function (scanner, match) {
assert.equal(scanner.pos, 2); assert.equal(scanner.pos, 2);
} }
} }
@@ -104,10 +104,10 @@ vows.describe("Mustache.Scanner").addBatch({
var match = scanner.scanUntil(/z/); var match = scanner.scanUntil(/z/);
this.callback(scanner, match); this.callback(scanner, match);
}, },
"it should return the entire string": function (scanner, match) {
"returns the entire string": function (scanner, match) {
assert.equal(match, scanner.string); assert.equal(match, scanner.string);
}, },
"it should be at the end of the string": function (scanner, match) {
"is at the end of the string": function (scanner, match) {
assert(scanner.eos()); assert(scanner.eos());
} }
} // when the regexp doesn't match } // when the regexp doesn't match


Loading…
Отказ
Запис