mirror of https://github.com/zulip/zulip.git
Add test_narrowed() to narrow.js unit tests.
(imported from commit 060032ac00d0c28a9625e2885ee3156bc94ff130)
This commit is contained in:
parent
51b8caf442
commit
a4e2ed9fd2
|
@ -21,6 +21,34 @@ function set_filter(operators) {
|
||||||
assert.equal(narrow.stream(), 'Foo');
|
assert.equal(narrow.stream(), 'Foo');
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
(function test_narrowed() {
|
||||||
|
narrow._set_current_filter(undefined); // not narrowed, basically
|
||||||
|
assert(!narrow.narrowed_to_pms());
|
||||||
|
assert(!narrow.narrowed_by_reply());
|
||||||
|
assert(!narrow.narrowed_to_search());
|
||||||
|
|
||||||
|
set_filter([['stream', 'Foo']]);
|
||||||
|
assert(!narrow.narrowed_to_pms());
|
||||||
|
assert(!narrow.narrowed_by_reply());
|
||||||
|
assert(!narrow.narrowed_to_search());
|
||||||
|
|
||||||
|
set_filter([['pm-with', 'steve@zulip.com']]);
|
||||||
|
assert(narrow.narrowed_to_pms());
|
||||||
|
assert(narrow.narrowed_by_reply());
|
||||||
|
assert(!narrow.narrowed_to_search());
|
||||||
|
|
||||||
|
set_filter([['stream', 'Foo'], ['topic', 'bar']]);
|
||||||
|
assert(!narrow.narrowed_to_pms());
|
||||||
|
assert(narrow.narrowed_by_reply());
|
||||||
|
assert(!narrow.narrowed_to_search());
|
||||||
|
|
||||||
|
set_filter([['search', 'grail']]);
|
||||||
|
assert(!narrow.narrowed_to_pms());
|
||||||
|
assert(!narrow.narrowed_by_reply());
|
||||||
|
assert(narrow.narrowed_to_search());
|
||||||
|
}());
|
||||||
|
|
||||||
(function test_operators() {
|
(function test_operators() {
|
||||||
set_filter([['stream', 'Foo'], ['topic', 'Bar'], ['search', 'Yo']]);
|
set_filter([['stream', 'Foo'], ['topic', 'Bar'], ['search', 'Yo']]);
|
||||||
var canonical_operators = [['stream', 'Foo'], ['topic', 'Bar'], ['search', 'yo']];
|
var canonical_operators = [['stream', 'Foo'], ['topic', 'Bar'], ['search', 'yo']];
|
||||||
|
|
Loading…
Reference in New Issue