Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
todomvc
Commits
f1084f90
Commit
f1084f90
authored
Jun 30, 2012
by
Stas SUȘCOV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a set of specs for checking todos cration, completion and deletion. See #200
parent
a8f4b4d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
0 deletions
+112
-0
dependency-examples/emberjs_require/js/app/specs/todoMVC.js
dependency-examples/emberjs_require/js/app/specs/todoMVC.js
+112
-0
No files found.
dependency-examples/emberjs_require/js/app/specs/todoMVC.js
0 → 100644
View file @
f1084f90
/**
* TodoMVC Project Specs
*
* Use `runs` and `waits` to make sure results are run synchroneously
*/
describe
(
'
TodoMVC features.
'
,
function
(){
var
enterEvent
=
$
.
Event
(
'
keyup
'
,
{
keyCode
:
13
});
var
todoTitle
=
'
Foo Bar Todo
'
;
describe
(
'
Todo creation:
'
,
function
()
{
beforeEach
(
function
(){
// Make sure we are always on the main screen
window
.
location
.
hash
=
'
#/
'
;
});
it
(
'
should allow creating a new todo
'
,
function
()
{
runs
(
function
(){
$
(
'
#new-todo
'
).
val
(
todoTitle
).
trigger
(
enterEvent
);
});
waits
(
100
);
runs
(
function
()
{
!!
$
(
'
#todo-list li
'
).
text
().
match
(
todoTitle
);
});
});
it
(
'
should not allow adding an empty todo
'
,
function
()
{
var
ourTodo
,
beforeCount
=
$
(
'
#todo-list li
'
).
length
;
runs
(
function
(){
$
(
'
#new-todo
'
).
val
(
'
'
).
trigger
(
enterEvent
);
});
waits
(
100
);
runs
(
function
(){
expect
(
$
(
'
#todo-list li
'
).
length
).
toEqual
(
beforeCount
);
});
});
});
describe
(
'
Todo completion:
'
,
function
()
{
it
(
'
should allow marking a todo complete
'
,
function
()
{
var
ourTodo
,
beforeCount
=
$
(
'
#todo-list li.completed
'
).
length
,
postTitle
=
'
to be completed
'
;
runs
(
function
(){
$
(
'
#new-todo
'
).
val
(
todoTitle
+
postTitle
).
trigger
(
enterEvent
);
});
waits
(
100
);
runs
(
function
()
{
ourTodo
=
$
(
'
#todo-list li:last-child
'
);
expect
(
ourTodo
.
text
()
).
toMatch
(
postTitle
);
ourTodo
.
find
(
'
.toggle
'
).
click
();
expect
(
$
(
'
#todo-list li.completed
'
).
length
).
toEqual
(
beforeCount
+
1
);
});
});
it
(
'
should allow clearing completed todos
'
,
function
()
{
var
ourTodo
,
beforeCount
=
$
(
'
#todo-list li.completed
'
).
length
,
postTitle
=
'
to be completed
'
;
runs
(
function
(){
$
(
'
#new-todo
'
).
val
(
todoTitle
+
postTitle
).
trigger
(
enterEvent
);
});
waits
(
100
);
runs
(
function
()
{
ourTodo
=
$
(
'
#todo-list li:last-child
'
);
expect
(
ourTodo
.
text
()
).
toMatch
(
postTitle
);
ourTodo
.
find
(
'
.toggle
'
).
click
();
$
(
'
#clear-completed
'
).
click
();
expect
(
$
(
'
#todo-list li.completed
'
).
length
).
toEqual
(
0
);
});
});
});
describe
(
'
Todo deletion:
'
,
function
()
{
it
(
'
should allow deleting a todo
'
,
function
()
{
var
ourTodo
,
beforeCount
=
$
(
'
#todo-list li
'
).
length
,
postTitle
=
'
to be deleted
'
;
runs
(
function
(){
$
(
'
#new-todo
'
).
val
(
todoTitle
+
postTitle
).
trigger
(
enterEvent
);
});
waits
(
100
);
runs
(
function
()
{
ourTodo
=
$
(
'
#todo-list li:last-child
'
);
expect
(
ourTodo
.
text
()
).
toMatch
(
postTitle
);
ourTodo
.
find
(
'
.destroy
'
).
click
();
expect
(
$
(
'
#todo-list li
'
).
length
).
toEqual
(
beforeCount
);
});
});
});
});
Write
Preview
Markdown
is supported
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