aboutsummaryrefslogtreecommitdiffstats
path: root/docs/component-spec
diff options
context:
space:
mode:
authorMatias Niemelä2013-05-16 16:05:21 -0400
committerMisko Hevery2013-05-20 14:33:11 -0700
commit5f92d4144ea3c8c8fc33e163b3973401b527a4bd (patch)
tree0211a1f8a6108bdb21c689ef084d2093b42faecd /docs/component-spec
parent2f571a9c830df814902fbdda1e9240b36bb64e3e (diff)
downloadangular.js-5f92d4144ea3c8c8fc33e163b3973401b527a4bd.tar.bz2
fix(ngdocs): provide test code for syntax links in docs and fix the syntax directive for IE8
Diffstat (limited to 'docs/component-spec')
-rw-r--r--docs/component-spec/syntaxSpec.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/docs/component-spec/syntaxSpec.js b/docs/component-spec/syntaxSpec.js
new file mode 100644
index 00000000..2868602b
--- /dev/null
+++ b/docs/component-spec/syntaxSpec.js
@@ -0,0 +1,50 @@
+describe('Docs Syntax', function() {
+
+ beforeEach(module('bootstrap'));
+
+ describe('syntax', function() {
+
+ var id, element, document;
+
+ beforeEach(inject(function($compile, $rootScope, $document) {
+ document = $document[0];
+ //create the HTML elements missing in IE8 for this directive
+ document.createElement('nav');
+
+ element = angular.element(
+ '<div>' +
+ '<pre syntax ' +
+ 'syntax-github="gh-url" ' +
+ 'syntax-plunkr="pl-url" ' +
+ 'syntax-fiddle="jf-url">' +
+ '</pre>' +
+ '</div>'
+ );
+ $compile(element)($rootScope);
+ $rootScope.$digest();
+
+ element = element[0];
+ document.body.appendChild(element);
+ }));
+
+ it("should properly prepare a github link in the page", function() {
+ var github = element.querySelector('.syntax-github');
+ expect(github.innerHTML).toMatch(/View on Github/i);
+ expect(github.getAttribute('href')).toBe('gh-url');
+ });
+
+ it("should properly prepare a plunkr link in the page", function() {
+ var plunkr = element.querySelector('.syntax-plunkr');
+ expect(plunkr.innerHTML).toMatch(/View on Plunkr/i);
+ expect(plunkr.getAttribute('href')).toBe('pl-url');
+ });
+
+ it("should properly prepare a jsfiddle link in the page", function() {
+ var jsfiddle = element.querySelector('.syntax-jsfiddle');
+ expect(jsfiddle.innerHTML).toMatch(/View on JSFiddle/i);
+ expect(jsfiddle.getAttribute('href')).toBe('jf-url');
+ });
+
+ });
+
+});