mirror of
https://github.com/discourse/discourse.git
synced 2025-09-11 21:04:42 +08:00
Convert Discourse.User
to use Discourse.Singleton
This commit is contained in:
parent
8e1fae0459
commit
51f5cf77fb
23 changed files with 90 additions and 57 deletions
|
@ -85,12 +85,12 @@ var badgeClickCount = function(id, expected) {
|
|||
};
|
||||
|
||||
test("does not update badge clicks on my own link", function() {
|
||||
this.stub(Discourse.User, 'current').returns(314);
|
||||
this.stub(Discourse.User, 'currentProp').withArgs('id').returns(314);
|
||||
badgeClickCount('with-badge', 1);
|
||||
});
|
||||
|
||||
test("does not update badge clicks in my own post", function() {
|
||||
this.stub(Discourse.User, 'current').returns(3141);
|
||||
this.stub(Discourse.User, 'currentProp').withArgs('id').returns(3141);
|
||||
badgeClickCount('with-badge-but-not-mine', 1);
|
||||
});
|
||||
|
||||
|
@ -167,7 +167,7 @@ test("does not track via AJAX for attachments", function() {
|
|||
|
||||
test("tracks custom urls when opening in another window", function() {
|
||||
var clickEvent = generateClickEventOn('a');
|
||||
this.stub(Discourse.User, "current").returns(true);
|
||||
this.stub(Discourse.User, "currentProp").withArgs('external_links_in_new_tab').returns(true);
|
||||
ok(!track(clickEvent));
|
||||
ok(this.windowOpen.calledWith('/clicks/track?url=http%3A%2F%2Fwww.google.com&post_id=42', '_blank'));
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ test("uploading one file", function() {
|
|||
|
||||
test("new user cannot upload images", function() {
|
||||
Discourse.SiteSettings.newuser_max_images = 0;
|
||||
this.stub(Discourse.User, 'current').withArgs("trust_level").returns(0);
|
||||
this.stub(Discourse.User, 'currentProp').withArgs("trust_level").returns(0);
|
||||
this.stub(bootbox, "alert");
|
||||
|
||||
ok(!validUpload([{name: "image.png"}]));
|
||||
|
@ -33,7 +33,7 @@ test("new user cannot upload images", function() {
|
|||
|
||||
test("new user cannot upload attachments", function() {
|
||||
Discourse.SiteSettings.newuser_max_attachments = 0;
|
||||
this.stub(Discourse.User, 'current').withArgs("trust_level").returns(0);
|
||||
this.stub(Discourse.User, 'currentProp').withArgs("trust_level").returns(0);
|
||||
this.stub(bootbox, "alert");
|
||||
|
||||
ok(!validUpload([{name: "roman.txt"}]));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue