Fix services char counter

This commit is contained in:
Steffen van Bergerem 2015-03-09 21:11:36 +01:00
parent dd9c8d5632
commit 1b2b10877a
3 changed files with 14 additions and 0 deletions

View file

@ -361,6 +361,8 @@ app.views.Publisher = Backbone.View.extend({
// clear text(s)
this.el_input.val('');
this.el_hiddenInput.val('');
this.el_input.trigger('keyup')
.trigger('keydown');
// remove mentions
this.el_input.mentionsInput('reset');

View file

@ -7,6 +7,7 @@
#location_container,
#hide_publisher,
#photodropzone_container,
.counter,
.options_and_submit {
display: none !important;
}

View file

@ -264,6 +264,17 @@ describe("app.views.Publisher", function() {
expect(this.view.$('input[name="services[]"][value="'+prov1+'"]').length).toBe(0);
expect(this.view.$('input[name="services[]"][value="'+prov2+'"]').length).toBe(1);
});
describe("#clear", function() {
it("resets the char counter", function() {
this.view.$(".service_icon").first().trigger("click");
expect(parseInt(this.view.$(".counter").text(), 10)).toBeGreaterThan(0);
this.view.$(".counter").text("0");
expect(parseInt(this.view.$(".counter").text(), 10)).not.toBeGreaterThan(0);
this.view.clear($.Event());
expect(parseInt(this.view.$(".counter").text(), 10)).toBeGreaterThan(0);
});
});
});
context("aspect selection", function(){