diff --git a/lib/console/console.js b/lib/console/console.js index e1548066..cbc4f93e 100644 --- a/lib/console/console.js +++ b/lib/console/console.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2015 Pivotal Labs +Copyright (c) 2008-2016 Pivotal Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/lib/jasmine-core/boot.js b/lib/jasmine-core/boot.js index a1002de7..2f39ce16 100644 --- a/lib/jasmine-core/boot.js +++ b/lib/jasmine-core/boot.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2015 Pivotal Labs +Copyright (c) 2008-2016 Pivotal Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js index da23532e..a72404ed 100644 --- a/lib/jasmine-core/jasmine-html.js +++ b/lib/jasmine-core/jasmine-html.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2015 Pivotal Labs +Copyright (c) 2008-2016 Pivotal Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -209,9 +209,10 @@ jasmineRequire.HtmlReporter = function(j$) { if (specsExecuted < totalSpecsDefined) { var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all'; + var skippedLink = order && order.random ? '?random=true' : '?'; alert.appendChild( createDom('span', {className: 'jasmine-bar jasmine-skipped'}, - createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage) + createDom('a', {href: skippedLink, title: 'Run all specs'}, skippedMessage) ) ); } diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 5d56c8f7..2b3d9dcc 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2015 Pivotal Labs +Copyright (c) 2008-2016 Pivotal Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/lib/jasmine-core/node_boot.js b/lib/jasmine-core/node_boot.js index a0fc4a25..6344b6dd 100644 --- a/lib/jasmine-core/node_boot.js +++ b/lib/jasmine-core/node_boot.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2015 Pivotal Labs +Copyright (c) 2008-2016 Pivotal Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/spec/html/HtmlReporterSpec.js b/spec/html/HtmlReporterSpec.js index e7a0c0ee..593cc20d 100644 --- a/spec/html/HtmlReporterSpec.js +++ b/spec/html/HtmlReporterSpec.js @@ -690,6 +690,41 @@ describe("New HtmlReporter", function() { expect(seedBar).toBeNull(); }); + it("should include the random query param in the jasmine-skipped link when randomizing", function(){ + var env = new jasmineUnderTest.Env(), + container = document.createElement("div"), + reporter = new jasmineUnderTest.HtmlReporter({ + env: env, + getContainer: function() { return container; }, + createElement: function() { return document.createElement.apply(document, arguments); }, + createTextNode: function() { return document.createTextNode.apply(document, arguments); } + }); + + reporter.initialize(); + reporter.jasmineStarted({ totalSpecsDefined: 1 }); + reporter.jasmineDone({ order: { random: true } }); + + var skippedLink = container.querySelector(".jasmine-skipped a"); + expect(skippedLink.getAttribute('href')).toEqual('?random=true'); + }); + + it("should not include the random query param in the jasmine-skipped link when not randomizing", function(){ + var env = new jasmineUnderTest.Env(), + container = document.createElement("div"), + reporter = new jasmineUnderTest.HtmlReporter({ + env: env, + getContainer: function() { return container; }, + createElement: function() { return document.createElement.apply(document, arguments); }, + createTextNode: function() { return document.createTextNode.apply(document, arguments); } + }); + + reporter.initialize(); + reporter.jasmineStarted({ totalSpecsDefined: 1 }); + reporter.jasmineDone(); + + var skippedLink = container.querySelector(".jasmine-skipped a"); + expect(skippedLink.getAttribute('href')).toEqual('?'); + }); }); it("shows a message if no specs are run", function(){ diff --git a/src/html/HtmlReporter.js b/src/html/HtmlReporter.js index 9c150604..0628adb0 100644 --- a/src/html/HtmlReporter.js +++ b/src/html/HtmlReporter.js @@ -180,9 +180,10 @@ jasmineRequire.HtmlReporter = function(j$) { if (specsExecuted < totalSpecsDefined) { var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all'; + var skippedLink = order && order.random ? '?random=true' : '?'; alert.appendChild( createDom('span', {className: 'jasmine-bar jasmine-skipped'}, - createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage) + createDom('a', {href: skippedLink, title: 'Run all specs'}, skippedMessage) ) ); }