mirror of
https://github.com/discourse/discourse.git
synced 2025-09-12 21:10:47 +08:00
Quoting another reply won't satisfy the minimum character count (fixes #180)
This commit is contained in:
parent
72edc9262b
commit
4fa4c15559
9 changed files with 54 additions and 19 deletions
27
spec/javascripts/models/composer_spec.js
Normal file
27
spec/javascripts/models/composer_spec.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
describe("Discourse.Composer", function() {
|
||||
|
||||
describe("replyLength", function() {
|
||||
|
||||
it("returns the length of a basic reply", function() {
|
||||
var composer = Discourse.Composer.create({ reply: "basic reply" });
|
||||
expect(composer.get('replyLength')).toBe(11);
|
||||
});
|
||||
|
||||
it("trims whitespaces", function() {
|
||||
var composer = Discourse.Composer.create({ reply: "\nbasic reply\t" });
|
||||
expect(composer.get('replyLength')).toBe(11);
|
||||
});
|
||||
|
||||
it("removes quotes", function() {
|
||||
var composer = Discourse.Composer.create({ reply: "1[quote=]not counted[/quote]2[quote=]at all[/quote]3" });
|
||||
expect(composer.get('replyLength')).toBe(3);
|
||||
});
|
||||
|
||||
it("handles nested quotes correctly", function() {
|
||||
var composer = Discourse.Composer.create({ reply: "1[quote=]not[quote=]counted[/quote]yay[/quote]2" });
|
||||
expect(composer.get('replyLength')).toBe(2);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue