Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
9ed6dbe4
Commit
9ed6dbe4
authored
May 18, 2016
by
Rafael Ostertag
Browse files
Use a template to refresh test environment for each test.
parent
1fee4faa
Changes
11
Hide whitespace changes
Inline
Side-by-side
tests/jasmine/unit/SpecRunner.html
View file @
9ed6dbe4
...
...
@@ -8,6 +8,9 @@
<link
rel=
"stylesheet"
href=
"../lib/jasmine-2.4.1/jasmine.css"
>
<link
rel=
"stylesheet"
href=
"../../../css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"../../../css/bootstrap-theme.min.css"
>
<link
rel=
"stylesheet"
href=
"../../../css/jqx.base.css"
>
<link
rel=
"stylesheet"
href=
"../../../css/jqx.bootstrap.css"
>
<link
rel=
"stylesheet"
href=
"../../../css/qfq-bs.css"
>
<script
src=
"../lib/jasmine-2.4.1/jasmine.js"
></script>
<script
src=
"../lib/jasmine-2.4.1/jasmine-html.js"
></script>
...
...
@@ -16,6 +19,7 @@
<script
src=
"../../../js/jquery.min.js"
></script>
<script
src=
"../../../js/bootstrap.min.js"
></script>
<script
src=
"../../../js/jqx-all.js"
></script>
<script
src=
"../../../js/EventEmitter.min.js"
></script>
<!-- include source files here... -->
...
...
@@ -31,12 +35,16 @@
<script
src=
"spec/BSTabsSpec.js"
></script>
<script
src=
"spec/PageTitleSpec.js"
></script>
<script
src=
"spec/FormSpec.js"
></script>
<script
src=
"spec/HelperJqxDateTimeInputSpec.js"
></script>
</head>
<body>
<section
class=
"container-fluid"
>
<section
class=
"container-fluid"
id=
"jasmineTestTemplateTarget"
>
</section>
<script
type=
"jasmine/test-template"
id=
"jasmineTestTemplate"
>
<
header
class
=
"
page-header
"
>
<
h1
>
Keep
Track
of
Navigation
State
<
/h1
>
<
/header
>
...
...
@@ -212,6 +220,7 @@
<
/div
>
<!--
a
disturber
hidden
element
-->
<
input
type
=
"
hidden
"
name
=
"
personTitle
"
>
<
div
class
=
"
col-md-6
"
>
<
select
id
=
"
personTitle
"
class
=
"
form-control
"
name
=
"
personTitle
"
>
<
option
>
none
<
/option
>
...
...
@@ -243,9 +252,11 @@
<!--
a
disturber
hidden
element
-->
<
input
type
=
"
hidden
"
name
=
"
gender
"
>
<
div
class
=
"
col-md-6
"
>
<!--
a
disturber
hidden
element
-->
<
input
type
=
"
hidden
"
name
=
"
gender
"
>
<
div
class
=
"
radio
"
>
<
label
>
<
input
type
=
"
radio
"
name
=
"
gender
"
value
=
"
male
"
>
male
...
...
@@ -349,10 +360,46 @@
<
/div
>
<
/div
>
<
/form
>
<
div
class
=
"
form-group
"
>
</section>
<
div
class
=
"
col-md-2
"
>
<
label
for
=
"
datetimepicker1
"
class
=
"
control-label
"
>
datetimepicker1
<
/label
>
<
/div
>
<
div
class
=
"
col-md-6
"
>
<
div
id
=
"
datetimepicker1
"
class
=
"
jqw-datetimepicker
"
data
-
control
-
name
=
"
datetimepicker
"
data
-
format
-
string
=
"
dd.MM.yyyy HH:mm
"
data
-
show
-
time
-
button
=
"
true
"
><
/div
>
<
/div
>
<
/div
>
<
div
class
=
"
form-group
"
>
<
div
class
=
"
col-md-2
"
>
<
label
for
=
"
anotherDate
"
class
=
"
control-label
"
>
Another
Date
<
/label
>
<
/div
>
<
div
class
=
"
col-md-6
"
>
<
div
id
=
"
anotherDate
"
class
=
"
jqw-datetimepicker
"
data
-
control
-
name
=
"
anotherDate
"
data
-
format
-
string
=
"
dd.MM.yyyy
"
data
-
show
-
time
-
button
=
"
false
"
><
/div
>
<
/div
>
<
/div
>
<
div
class
=
"
form-group
"
>
<
div
class
=
"
col-md-2
"
>
<
label
for
=
"
combobox1
"
class
=
"
control-label
"
>
Combobox
1
<
/label
>
<
/div
>
<
div
class
=
"
col-md-6
"
>
<
div
id
=
"
combobox1
"
class
=
"
jqw-combobox
"
data
-
control
-
name
=
"
combobox1
"
><
/div
>
<
/div
>
<
/div
>
<
/form
>
</script>
</body>
</html>
tests/jasmine/unit/SpecRunner.tmpl
View file @
9ed6dbe4
...
...
@@ -10,7 +10,11 @@
</head>
<body>
<section
class=
"container-fluid"
>
<section
class=
"container-fluid"
id=
"jasmineTestTemplateTarget"
>
</section>
<script
type=
"jasmine/test-template"
id=
"jasmineTestTemplate"
>
<
header
class
=
"
page-header
"
>
<
h1
>
Keep
Track
of
Navigation
State
<
/h1
>
<
/header
>
...
...
@@ -186,6 +190,7 @@
<
/div
>
<!--
a
disturber
hidden
element
-->
<
input
type
=
"
hidden
"
name
=
"
personTitle
"
>
<
div
class
=
"
col-md-6
"
>
<
select
id
=
"
personTitle
"
class
=
"
form-control
"
name
=
"
personTitle
"
>
<
option
>
none
<
/option
>
...
...
@@ -217,9 +222,11 @@
<!--
a
disturber
hidden
element
-->
<
input
type
=
"
hidden
"
name
=
"
gender
"
>
<
div
class
=
"
col-md-6
"
>
<!--
a
disturber
hidden
element
-->
<
input
type
=
"
hidden
"
name
=
"
gender
"
>
<
div
class
=
"
radio
"
>
<
label
>
<
input
type
=
"
radio
"
name
=
"
gender
"
value
=
"
male
"
>
male
...
...
@@ -323,8 +330,46 @@
<
/div
>
<
/div
>
<
div
class
=
"
form-group
"
>
<
div
class
=
"
col-md-2
"
>
<
label
for
=
"
datetimepicker1
"
class
=
"
control-label
"
>
datetimepicker1
<
/label
>
<
/div
>
<
div
class
=
"
col-md-6
"
>
<
div
id
=
"
datetimepicker1
"
class
=
"
jqw-datetimepicker
"
data
-
control
-
name
=
"
datetimepicker
"
data
-
format
-
string
=
"
dd.MM.yyyy HH:mm
"
data
-
show
-
time
-
button
=
"
true
"
><
/div
>
<
/div
>
<
/div
>
<
div
class
=
"
form-group
"
>
<
div
class
=
"
col-md-2
"
>
<
label
for
=
"
anotherDate
"
class
=
"
control-label
"
>
Another
Date
<
/label
>
<
/div
>
<
div
class
=
"
col-md-6
"
>
<
div
id
=
"
anotherDate
"
class
=
"
jqw-datetimepicker
"
data
-
control
-
name
=
"
anotherDate
"
data
-
format
-
string
=
"
dd.MM.yyyy
"
data
-
show
-
time
-
button
=
"
false
"
><
/div
>
<
/div
>
<
/div
>
<
div
class
=
"
form-group
"
>
<
div
class
=
"
col-md-2
"
>
<
label
for
=
"
combobox1
"
class
=
"
control-label
"
>
Combobox
1
<
/label
>
<
/div
>
<
div
class
=
"
col-md-6
"
>
<
div
id
=
"
combobox1
"
class
=
"
jqw-combobox
"
data
-
control
-
name
=
"
combobox1
"
><
/div
>
<
/div
>
<
/div
>
<
/form
>
</s
ection
>
</s
cript
>
<
%
with
(
scripts
)
{
%
>
<
%
[].
concat
(
polyfills
,
jasmine
,
boot
,
vendor
,
helpers
,
src
,
specs
,
reporters
).
forEach
(
function
(
script
){
%
>
<script
src=
"<%= script %>"
></script>
...
...
tests/jasmine/unit/spec/BSTabsSpec.js
View file @
9ed6dbe4
...
...
@@ -2,11 +2,13 @@
* @author Rafael Ostertag <rafael.ostertag@math.uzh.ch>
*/
/* global $ */
/* global describe */
/* global it */
/* global expect */
/* global QfqNS */
/* global beforeAll */
/* global beforeEach */
/* global jasmine */
describe
(
"
Bootstrap Tabs
"
,
function
()
{
...
...
@@ -14,7 +16,10 @@ describe("Bootstrap Tabs", function () {
var
bsTabs
;
beforeAll
(
function
()
{
beforeEach
(
function
()
{
$
(
"
#jasmineTestTemplateTarget
"
)
.
empty
()
.
append
(
$
(
"
#jasmineTestTemplate
"
).
text
());
bsTabs
=
new
QfqNS
.
BSTabs
(
"
qfqTabs
"
);
});
...
...
tests/jasmine/unit/spec/ElementCheckboxSpec.js
View file @
9ed6dbe4
...
...
@@ -16,17 +16,16 @@ describe("Element Checkbox", function () {
var
reminderCheckbox
,
checkbox2
;
var
$reminderCheckbox
,
$checkbox2
;
beforeAll
(
function
()
{
beforeEach
(
function
()
{
$
(
"
#jasmineTestTemplateTarget
"
)
.
empty
()
.
append
(
$
(
"
#jasmineTestTemplate
"
).
text
());
$reminderCheckbox
=
$
(
'
input[name=reminder]
'
);
$checkbox2
=
$
(
'
input[name=checkbox2]
'
);
reminderCheckbox
=
new
QfqNS
.
Element
.
Checkbox
(
$reminderCheckbox
);
checkbox2
=
new
QfqNS
.
Element
.
Checkbox
(
$checkbox2
);
});
beforeEach
(
function
()
{
$
(
'
#myForm
'
)[
0
].
reset
();
});
it
(
'
should get the initial checked value
'
,
function
()
{
expect
(
reminderCheckbox
.
getValue
()).
toBe
(
false
);
expect
(
checkbox2
.
getValue
()).
toBe
(
true
);
...
...
tests/jasmine/unit/spec/ElementFormGroupSpec.js
View file @
9ed6dbe4
...
...
@@ -16,7 +16,10 @@ describe("Element FormGroup", function () {
var
personHandle
;
var
personGender
;
beforeAll
(
function
()
{
beforeEach
(
function
()
{
$
(
"
#jasmineTestTemplateTarget
"
)
.
empty
()
.
append
(
$
(
"
#jasmineTestTemplate
"
).
text
());
personGeburtstag
=
new
QfqNS
.
Element
.
FormGroup
(
$
(
"
input#personGeburtstag
"
));
personHandle
=
new
QfqNS
.
Element
.
FormGroup
(
$
(
"
input#personHandle
"
));
personGender
=
new
QfqNS
.
Element
.
FormGroup
(
$
(
"
input[name='gender']
"
));
...
...
tests/jasmine/unit/spec/ElementRadioSpec.js
View file @
9ed6dbe4
...
...
@@ -6,6 +6,7 @@
/* global expect */
/* global QfqNS */
/* global beforeAll */
/* global beforeEach */
/* global jasmine */
/* global $ */
...
...
@@ -14,7 +15,10 @@ describe("Element Radio", function () {
var
$radioInput
;
var
radioInput
;
beforeAll
(
function
()
{
beforeEach
(
function
()
{
$
(
"
#jasmineTestTemplateTarget
"
)
.
empty
()
.
append
(
$
(
"
#jasmineTestTemplate
"
).
text
());
$radioInput
=
$
(
"
input[name='gender']
"
);
radioInput
=
new
QfqNS
.
Element
.
Radio
(
$radioInput
);
});
...
...
tests/jasmine/unit/spec/ElementSelectSpec.js
View file @
9ed6dbe4
...
...
@@ -6,6 +6,7 @@
/* global expect */
/* global QfqNS */
/* global beforeAll */
/* global beforeEach */
/* global jasmine */
/* global $ */
...
...
@@ -16,6 +17,9 @@ describe("Element Select", function () {
var
selectTest2
;
beforeAll
(
function
()
{
$
(
"
#jasmineTestTemplateTarget
"
)
.
empty
()
.
append
(
$
(
"
#jasmineTestTemplate
"
).
text
());
personTitleSelect
=
new
QfqNS
.
Element
.
Select
(
$
(
'
#personTitle
'
));
selectTest2
=
new
QfqNS
.
Element
.
Select
(
$
(
'
#selectTest2
'
));
});
...
...
tests/jasmine/unit/spec/ElementSpec.js
View file @
9ed6dbe4
...
...
@@ -7,11 +7,18 @@
/* global expect */
/* global QfqNS */
/* global beforeAll */
/* global beforeEach */
/* global jasmine */
/* global $ */
describe
(
'
Element namespace function getElement()
'
,
function
()
{
'
use strict
'
;
beforeEach
(
function
()
{
$
(
"
#jasmineTestTemplateTarget
"
)
.
empty
()
.
append
(
$
(
"
#jasmineTestTemplate
"
).
text
());
});
it
(
"
should get the proper element instance for radio
"
,
function
()
{
var
element
=
QfqNS
.
Element
.
getElement
(
'
gender
'
);
expect
(
element
instanceof
QfqNS
.
Element
.
Radio
).
toBe
(
true
);
...
...
tests/jasmine/unit/spec/ElementTextualSpec.js
View file @
9ed6dbe4
...
...
@@ -6,6 +6,7 @@
/* global expect */
/* global QfqNS */
/* global beforeAll */
/* global beforeEach */
/* global jasmine */
/* global $ */
...
...
@@ -14,7 +15,10 @@ describe("Element Text", function () {
var
$textInput
;
var
textInput
;
beforeAll
(
function
()
{
beforeEach
(
function
()
{
$
(
"
#jasmineTestTemplateTarget
"
)
.
empty
()
.
append
(
$
(
"
#jasmineTestTemplate
"
).
text
());
$textInput
=
$
(
"
input[name='personHandle']
"
);
textInput
=
new
QfqNS
.
Element
.
Textual
(
$textInput
);
});
...
...
tests/jasmine/unit/spec/FormSpec.js
View file @
9ed6dbe4
...
...
@@ -17,6 +17,9 @@ describe("Form", function () {
var
form
;
beforeEach
(
function
()
{
$
(
"
#jasmineTestTemplateTarget
"
)
.
empty
()
.
append
(
$
(
"
#jasmineTestTemplate
"
).
text
());
form
=
new
QfqNS
.
Form
(
"
myForm
"
);
});
...
...
tests/jasmine/unit/spec/HelperJqxDateTimeInputSpec.js
0 → 100644
View file @
9ed6dbe4
/**
* @author Rafael Ostertag <rafael.ostertag@math.uzh.ch>
*/
/* global describe */
/* global it */
/* global expect */
/* global QfqNS */
/* global beforeAll */
/* global beforeEach */
/* global jasmine */
/* global $ */
describe
(
"
jqxDateTimeInput helper
"
,
function
()
{
'
use strict
'
;
it
(
'
should properly initialize all date time inputs
'
,
function
()
{
QfqNS
.
Helper
.
jqxDateTimeInput
();
});
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment