forked from ariatemplates/ariatemplates
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat ariatemplates#1528 Add the role attribute for the modal dialog a…
…nd the error tooltip CR 08528144
- Loading branch information
Showing
15 changed files
with
567 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2015 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
Aria.classDefinition({ | ||
$classpath : "test.aria.widgets.wai.popup.WaiPopupTestSuite", | ||
$extends : "aria.jsunit.TestSuite", | ||
$constructor : function () { | ||
this.$TestSuite.constructor.call(this); | ||
this.addTests("test.aria.widgets.wai.popup.dialog.DialogTestCase"); | ||
this.addTests("test.aria.widgets.wai.popup.dialog.WaiDialogTestCase"); | ||
this.addTests("test.aria.widgets.wai.popup.errortooltip.ErrorTooltipTestCase"); | ||
this.addTests("test.aria.widgets.wai.popup.errortooltip.WaiErrorTooltipTestCase"); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2012 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
var Aria = require("ariatemplates/Aria"); | ||
|
||
module.exports = Aria.classDefinition({ | ||
$classpath : "test.aria.widgets.wai.popup.dialog.DialogTestCase", | ||
$extends : require("ariatemplates/jsunit/TemplateTestCase"), | ||
$prototype : { | ||
runTemplateTest : function () { | ||
// get widgets to be tested | ||
this.dialog1 = this.getWidgetInstance("dlg1"); | ||
this.dialog2 = this.getWidgetInstance("dlg2"); | ||
|
||
// Check the first dialog (non modal) | ||
var dom = this.dialog1._domElt; | ||
this.assertNull(dom.getAttribute('role'), "The role attribute shouldn't be set for a non modal dialog."); | ||
|
||
// Check the first dialog (modal) | ||
var dom = this.dialog2._domElt; | ||
this.assertNull(dom.getAttribute('role'), "The role attribute shouldn't be set to dialog for a modal dialog, as waiAria is set to false."); | ||
|
||
this.end(); | ||
|
||
} | ||
|
||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright 2015 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
{Template { | ||
$classpath : "test.aria.widgets.wai.popup.dialog.DialogTestCaseTpl", | ||
$hasScript : false | ||
}} | ||
|
||
{macro main()} | ||
{call dialogs(false)/} | ||
{/macro} | ||
{macro dialogs(waiAria)} | ||
{@aria:Dialog { | ||
id: "dlg1", | ||
title : "Non modal dialog", | ||
xpos: 50, | ||
ypos: 100, | ||
width: 400, | ||
height : 400, | ||
visible : true, | ||
macro: "macro1", | ||
center: false, | ||
waiAria : waiAria | ||
}/} | ||
{@aria:Dialog { | ||
id: "dlg2", | ||
title : "Modal dialog", | ||
xpos: 500, | ||
ypos: 100, | ||
width: 150, | ||
height : 150, | ||
visible : true, | ||
macro: "macro2", | ||
modal: true, | ||
center: false, | ||
waiAria : waiAria | ||
}/} | ||
{/macro} | ||
|
||
{macro macro1()} | ||
Macro 1 Content | ||
{/macro} | ||
|
||
{macro macro2()} | ||
Macro 2 Content | ||
{/macro} | ||
|
||
{/Template} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2012 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
var Aria = require("ariatemplates/Aria"); | ||
|
||
module.exports = Aria.classDefinition({ | ||
$classpath : "test.aria.widgets.wai.popup.dialog.WaiDialogTestCase", | ||
$extends : require("ariatemplates/jsunit/TemplateTestCase"), | ||
$prototype : { | ||
runTemplateTest : function () { | ||
// get widgets to be tested | ||
this.dialog1 = this.getWidgetInstance("dlg1"); | ||
this.dialog2 = this.getWidgetInstance("dlg2"); | ||
|
||
// Check the first dialog (non modal) | ||
var dom = this.dialog1._domElt; | ||
this.assertNull(dom.getAttribute('role'), "The role attribute shouldn't be set for a non modal dialog."); | ||
|
||
// Check the first dialog (modal) | ||
var dom = this.dialog2._domElt; | ||
this.assertEquals(dom.getAttribute('role'), "dialog", "The role attribute should be set to dialog for a modal dialog."); | ||
|
||
this.end(); | ||
|
||
} | ||
|
||
} | ||
}); |
24 changes: 24 additions & 0 deletions
24
test/aria/widgets/wai/popup/dialog/WaiDialogTestCaseTpl.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright 2015 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
{Template { | ||
$classpath : "test.aria.widgets.wai.popup.dialog.WaiDialogTestCaseTpl", | ||
$extends: "test.aria.widgets.wai.popup.dialog.DialogTestCaseTpl" | ||
}} | ||
|
||
{macro main()} | ||
{call dialogs(true)/} | ||
{/macro} | ||
|
||
{/Template} |
76 changes: 76 additions & 0 deletions
76
test/aria/widgets/wai/popup/errortooltip/ErrorTooltipTestCase.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright 2012 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
var Aria = require("ariatemplates/Aria"); | ||
|
||
module.exports = Aria.classDefinition({ | ||
$classpath : "test.aria.widgets.wai.popup.errortooltip.ErrorTooltipTestCase", | ||
$extends : require("ariatemplates/jsunit/TemplateTestCase"), | ||
$prototype : { | ||
runTemplateTest : function () { | ||
this.checkAttributes(false); | ||
}, | ||
checkAttributes : function (waiAria) { | ||
|
||
var fieldIds = ["tf","ta","nf","df","time","dp","ac","ms","sb","mac"]; | ||
var index = 0; | ||
var currentId = null; | ||
|
||
var clickOnField = function() { | ||
this.synEvent.click(this.getInputField(currentId), { | ||
fn : checkDom, | ||
scope : this | ||
}); | ||
}; | ||
|
||
var checkDom = function() { | ||
|
||
var widgetInstance = this.getWidgetInstance(currentId); | ||
this.waitFor({ | ||
condition : function() { | ||
return widgetInstance._onValidatePopup; | ||
}, | ||
callback : function() { | ||
var div = widgetInstance._onValidatePopup._div._domElt.parentNode; | ||
if (waiAria) { | ||
this.assertEquals(div.getAttribute("role"), "alert", "The role of the error tooltip should be set to %2 instead of %1"); | ||
} else { | ||
this.assertNull(div.getAttribute("role"), "The role of the error tooltip shouldn't be set"); | ||
} | ||
|
||
next.call(this); | ||
} | ||
}); | ||
|
||
}; | ||
|
||
var next = function() { | ||
var id = fieldIds[index]; | ||
if (id) { | ||
currentId = id; | ||
index++; | ||
clickOnField.call(this); | ||
|
||
} else { | ||
this.end(); | ||
} | ||
}; | ||
|
||
next.call(this); | ||
|
||
} | ||
|
||
} | ||
}); |
Oops, something went wrong.