forked from discourse/discourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: move category slug helper to Category model
- Loading branch information
Showing
6 changed files
with
32 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/*global waitsFor:true expect:true describe:true beforeEach:true it:true spyOn:true */ | ||
|
||
describe("Discourse.Category", function() { | ||
|
||
describe("slugFor", function() { | ||
|
||
it("returns the slug when it exists", function() { | ||
expect(Discourse.Category.slugFor({ slug: 'hello' })).toBe("hello"); | ||
}); | ||
|
||
it("returns id-category when slug is an empty string", function() { | ||
expect(Discourse.Category.slugFor({ id: 123, slug: '' })).toBe("123-category"); | ||
}); | ||
|
||
it("returns id-category without a slug", function() { | ||
expect(Discourse.Category.slugFor({ id: 456 })).toBe("456-category"); | ||
}); | ||
|
||
}); | ||
|
||
}); |