// Generated by CoffeeScript 1.6.3 describe('Annotator.Plugin.Document', function() { var $fix, annotator; $fix = null; annotator = null; beforeEach(function() { annotator = new Annotator($('
')[0], {}); return annotator.addPlugin('Document'); }); afterEach(function() { return $(document).unbind(); }); describe('has an annotator', function() { return it('should have an annotator', function() { return assert.ok(annotator); }); }); describe('has the plugin', function() { return it('should have Document plugin', function() { return assert.ok('Document' in annotator.plugins); }); }); return describe('annotation should have some metadata', function() { var annotation, head; head = $("head"); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); annotation = null; beforeEach(function() { return annotation = annotator.createAnnotation(); }); it('can create annotation', function() { return assert.ok(annotation); }); it('should have a document', function() { return assert.ok(annotation.document); }); it('should have a title, derived from highwire metadata if possible', function() { return assert.equal(annotation.document.title, 'Foo'); }); it('should have links with absoulte hrefs and types', function() { assert.ok(annotation.document.link); assert.equal(annotation.document.link.length, 7); assert.match(annotation.document.link[0].href, /^.+runner.html(\?.*)?$/); assert.equal(annotation.document.link[1].rel, "alternate"); assert.match(annotation.document.link[1].href, /^.+foo\.pdf$/); assert.equal(annotation.document.link[1].type, "application/pdf"); assert.equal(annotation.document.link[2].rel, "alternate"); assert.match(annotation.document.link[2].href, /^.+foo\.doc$/); assert.equal(annotation.document.link[2].type, "application/msword"); assert.equal(annotation.document.link[3].rel, "bookmark"); assert.equal(annotation.document.link[3].href, "http://example.com/bookmark"); assert.equal(annotation.document.link[4].href, "doi:10.1175/JCLI-D-11-00015.1"); assert.match(annotation.document.link[5].href, /.+foo\.pdf$/); assert.equal(annotation.document.link[5].type, "application/pdf"); return assert.equal(annotation.document.link[6].href, "doi:10.1175/JCLI-D-11-00015.1"); }); it('should have highwire metadata', function() { assert.ok(annotation.document.highwire); assert.deepEqual(annotation.document.highwire.pdf_url, ['foo.pdf']); assert.deepEqual(annotation.document.highwire.doi, ['10.1175/JCLI-D-11-00015.1']); return assert.deepEqual(annotation.document.highwire.title, ['Foo']); }); it('should have dublincore metadata', function() { assert.ok(annotation.document.dc); assert.deepEqual(annotation.document.dc.identifier, ["doi:10.1175/JCLI-D-11-00015.1", "isbn:123456789"]); return assert.deepEqual(annotation.document.dc.type, ["Article"]); }); it('should have facebook metadata', function() { assert.ok(annotation.document.facebook); return assert.deepEqual(annotation.document.facebook.url, ["http://example.com"]); }); it('should have eprints metadata', function() { assert.ok(annotation.document.eprints); return assert.deepEqual(annotation.document.eprints.title, ['Computer Lib / Dream Machines']); }); it('should have prism metadata', function() { assert.ok(annotation.document.prism); return assert.deepEqual(annotation.document.prism.title, ['Literary Machines']); }); it('should have twitter card metadata', function() { assert.ok(annotation.document.twitter); return assert.deepEqual(annotation.document.twitter.site, ['@okfn']); }); it('should have unique uris', function() { var uris; uris = annotator.plugins.Document.uris(); return assert.equal(uris.length, 5); }); return it('should have a favicon', function() { return assert.equal(annotation.document.favicon, 'http://example.com/images/icon.ico'); }); }); }); /* //@ sourceMappingURL=document_spec.map */