|
| 1 | +describe('Docs Syntax', function() { |
| 2 | + |
| 3 | + beforeEach(module('bootstrap')); |
| 4 | + |
| 5 | + describe('syntax', function() { |
| 6 | + |
| 7 | + var id, element, document; |
| 8 | + |
| 9 | + beforeEach(inject(function($compile, $rootScope, $document) { |
| 10 | + document = $document[0]; |
| 11 | + //create the HTML elements missing in IE8 for this directive |
| 12 | + document.createElement('nav'); |
| 13 | + |
| 14 | + element = angular.element( |
| 15 | + '<div>' + |
| 16 | + '<pre syntax ' + |
| 17 | + 'syntax-github="gh-url" ' + |
| 18 | + 'syntax-plunkr="pl-url" ' + |
| 19 | + 'syntax-fiddle="jf-url">' + |
| 20 | + '</pre>' + |
| 21 | + '</div>' |
| 22 | + ); |
| 23 | + $compile(element)($rootScope); |
| 24 | + $rootScope.$digest(); |
| 25 | + |
| 26 | + element = element[0]; |
| 27 | + document.body.appendChild(element); |
| 28 | + })); |
| 29 | + |
| 30 | + it("should properly prepare a github link in the page", function() { |
| 31 | + var github = element.querySelector('.syntax-github'); |
| 32 | + expect(github.innerHTML).toMatch(/View on Github/i); |
| 33 | + expect(github.getAttribute('href')).toBe('gh-url'); |
| 34 | + }); |
| 35 | + |
| 36 | + it("should properly prepare a plunkr link in the page", function() { |
| 37 | + var plunkr = element.querySelector('.syntax-plunkr'); |
| 38 | + expect(plunkr.innerHTML).toMatch(/View on Plunkr/i); |
| 39 | + expect(plunkr.getAttribute('href')).toBe('pl-url'); |
| 40 | + }); |
| 41 | + |
| 42 | + it("should properly prepare a jsfiddle link in the page", function() { |
| 43 | + var jsfiddle = element.querySelector('.syntax-jsfiddle'); |
| 44 | + expect(jsfiddle.innerHTML).toMatch(/View on JSFiddle/i); |
| 45 | + expect(jsfiddle.getAttribute('href')).toBe('jf-url'); |
| 46 | + }); |
| 47 | + |
| 48 | + }); |
| 49 | + |
| 50 | +}); |
0 commit comments