| <!DOCTYPE html> |
| <!-- |
| Copyright 2015 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <link rel="import" href="/extras/drive/comments_side_panel.html"> |
| <link rel="import" href="/core/test_utils.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tr.b.unittest.testSuite(function() { |
| function StubCommentProvider() { |
| this.addDummyComment('Lorem ipsum dolor sit amet'); |
| this.addDummyComment('consectetur adipiscing elit'); |
| this.addDummyComment('sed do eiusmod tempor incididunt ut labore et ' + |
| 'dolore magna aliqua. Ut enim ad minim veniam, quis nostrud ' + |
| 'exercitation ullamco laboris nisi ut aliquip ex ea commodo ' + |
| 'consequat. Duis aute irure dolor in reprehenderit in voluptate ' + |
| 'velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint ' + |
| 'occaecat cupidatat non proident, sunt in culpa qui officia deserunt ' + |
| 'mollit anim id est laborum.'); |
| } |
| |
| StubCommentProvider.prototype = { |
| comments_: [], |
| |
| attachToElement: function(attachedElement) { |
| this.attachedElement_ = attachedElement; |
| this.updateComments(); |
| }, |
| |
| detachFromElement: function() { |
| }, |
| |
| updateComments: function() { |
| this.attachedElement_.comments_ = this.comments_; |
| }, |
| |
| addDummyComment: function(content) { |
| var newComment = { |
| author: { |
| displayName: 'Casper the Friendly Ghost', |
| picture: { |
| url: 'https://lh3.googleusercontent.com/-XdUIqdMkCWA/' + |
| 'AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/s128/photo.jpg' |
| } |
| }, |
| createdDate: Date.now(), |
| anchor: (this.comments_.length) % 2 ? 1 : 0, |
| content: content |
| }; |
| |
| this.comments_.push(newComment); |
| }, |
| |
| addComment: function(body) { |
| this.addDummyComment(body); |
| this.updateComments(); |
| } |
| }; |
| |
| test('instantiate', function() { |
| var panel = document.createElement('tr-e-d-comments-side-panel'); |
| panel.setCommentProvider(new StubCommentProvider); |
| this.addHTMLOutput(panel); |
| }); |
| }); |
| </script> |