Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
adiherzog committed Sep 4, 2015
2 parents b70e85e + b481d5f commit cd27123
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
11 changes: 10 additions & 1 deletion lib/pageNameExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@ function buildDefaultPageName(urlObject) {
var pageName = urlObject.pathname.substring(1);

if (urlObject.hash) {
pageName += urlObject.hash;
pageName += removeEveryhtingAfterQuestionMark(urlObject.hash);
}
return pageName;
}

function removeEveryhtingAfterQuestionMark(href) {
var pos = href.indexOf('?');
if (pos > -1) {
return href.substring(0, pos);
} else {
return href;
}
}

function isValidUrlObject(urlObject) {
return !_.isNull(urlObject.hostname) && !_.isNull(urlObject.protocol);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/scenarioDocuWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ var ScenarioDocuWriter = {
*/
saveUseCase: function (useCase) {
if (!utils.isDefined(this.buildOutputDir)) {
throw 'cannot save use case. No outputDirectory specified. docuWriter.start(branch, build, targetDir) not invoked?';
return; // this is allowed so that the web tests can be run without scenarioo documentation generation
}

entityValidator.validateUseCase(useCase);
Expand All @@ -204,7 +204,7 @@ var ScenarioDocuWriter = {
*/
saveScenario: function (currentScenario, useCaseName) {
if (!utils.isDefined(this.buildOutputDir)) {
throw 'cannot save use case. No outputDirectory specified. docuWriter.start(branch, build, targetDir) not invoked?';
return; // this is allowed so that the web tests can be run without scenarioo documentation generation
}

entityValidator.validateScenario(currentScenario);
Expand All @@ -222,7 +222,7 @@ var ScenarioDocuWriter = {
*/
saveStep: function (stepName, details) {
if (!utils.isDefined(this.buildOutputDir)) {
throw 'cannot save use case. No outputDirectory specified. docuWriter.start(branch, build, targetDir) not invoked?';
return; // this is allowed so that the web tests can be run without scenarioo documentation generation
}

var currentScenario = getCurrentScenario();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "scenarioo-js",
"description": "Scenarioo API for Javascript to generate Scenarioo Documentations",
"version": "0.1.8",
"version": "0.1.9",
"homepage": "http://scenarioo.org",
"author": {
"name": "xeronimus",
Expand Down
9 changes: 7 additions & 2 deletions test/unit/pageNameExtractorTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ describe('pageNameExtractor', function () {
expect(pageName).to.be('#/profile/details');
pageName = pageNameExtractor.getPageNameFromUrl('http://some-domain.com/home/#/profile/details');
expect(pageName).to.be('home/#/profile/details');

});

it('should return default page name from url with query params', function () {
var pageName = pageNameExtractor.getPageNameFromUrl('http://some-domain.com/index.php?action=some');
var pageName;

pageName = pageNameExtractor.getPageNameFromUrl('http://some-domain.com/index.php?action=some');
expect(pageName).to.be('index.php');
pageName = pageNameExtractor.getPageNameFromUrl('http://some-domain.com/#index.php?action=some');
expect(pageName).to.be('#index.php');
pageName = pageNameExtractor.getPageNameFromUrl('http://localhost:9000/#/step/Donate/find_donate_page/startSearch.jsp/0/0?branch=wikipedia-docu-example&build=2014-02-21');
expect(pageName).to.be('#/step/Donate/find_donate_page/startSearch.jsp/0/0');
});

it('should return whole input if invalid url', function () {
Expand Down

0 comments on commit cd27123

Please sign in to comment.