diaspora/spec/javascripts/bookmarklet-spec.js
Florian Staudacher 1924c40d38 replace vendored backbone.js/underscore.js with 'backbone-on-rails' gem
- updates underscore to 1.5.2 and backbone to 1.1.0

backbone had some breaking changes:
- fix url/urlRoot handling in models & collections
- options are no longer attached to the view by default
- collections reset when 'fetch' is called, tell it to keep the existing
  models

other changes:
- fix some events triggering multiple times in connection with deleting
  a model
- use document fragments instead of an element array for stream entries
- adapt jasmine and cucumber specs to the changed code
  * no longer test the backbone router as part of our code
  * jasmine factory already returns model instances, no need to wrap
    that again
2014-01-16 23:23:30 +01:00

54 lines
1.6 KiB
JavaScript

/* Copyright (c) 2010-2012, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
describe("bookmarklet", function() {
describe("base functionality", function(){
beforeEach( function(){
spec.loadFixture('empty_bookmarklet');
});
it('verifies the publisher is loaded', function(){
expect(typeof app.publisher === "object").toBeTruthy();
});
it('verifies we are using the bookmarklet', function(){
expect(app.publisher.standalone).toBeTruthy();
expect(app.publisher.$('#hide_publisher').is(':visible')).toBeFalsy();
});
});
describe("prefilled bookmarklet", function(){
it('fills in some text into the publisher', function(){
spec.loadFixture('prefilled_bookmarklet');
_.defer(function() {
expect($("#publisher #status_message_fake_text").val() == "").toBeFalsy();
expect($("#publisher #status_message_text").val() == "").toBeFalsy();
});
});
it('handles dirty input well', function(){
spec.loadFixture('prefilled_bookmarklet_dirty');
_.defer(function() {
expect($("#publisher #status_message_fake_text").val() == "").toBeFalsy();
expect($("#publisher #status_message_text").val() == "").toBeFalsy();
});
});
});
describe("modified prefilled bookmarklet", function(){
it('allows changing of post content', function(){
spec.loadFixture('prefilled_bookmarklet');
$('div.mentions > div').html('Foo Bar');
_.defer(function() {
expect($("#publisher #status_message_text").val()).toEqual("Foo Bar");
});
});
});
});