Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
cd01dc89
Commit
cd01dc89
authored
Jan 30, 2016
by
muhammad-ammar
Committed by
muzaffaryousaf
Feb 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clear search input when search results tab is closed
TNL-4055
parent
ce57700d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
0 deletions
+15
-0
lms/static/js/edxnotes/views/search_box.js
+6
-0
lms/static/js/edxnotes/views/tabs/search_results.js
+1
-0
lms/static/js/spec/edxnotes/views/search_box_spec.js
+6
-0
lms/static/js/spec/edxnotes/views/tabs/search_results_spec.js
+2
-0
No files found.
lms/static/js/edxnotes/views/search_box.js
View file @
cd01dc89
...
...
@@ -29,9 +29,15 @@ define([
this
.
logger
=
NotesLogger
.
getLogger
(
'search_box'
,
this
.
options
.
debug
);
this
.
$el
.
removeClass
(
'is-hidden'
);
this
.
isDisabled
=
false
;
this
.
searchInput
=
this
.
$el
.
find
(
'#search-notes-input'
);
this
.
logger
.
log
(
'initialized'
);
},
clearInput
:
function
()
{
// clear the search input box
this
.
searchInput
.
val
(
''
);
},
submitHandler
:
function
(
event
)
{
event
.
preventDefault
();
this
.
search
();
...
...
lms/static/js/edxnotes/views/tabs/search_results.js
View file @
cd01dc89
...
...
@@ -105,6 +105,7 @@ define([
onClose
:
function
()
{
this
.
searchResults
=
null
;
this
.
searchBox
.
clearInput
();
},
onBeforeSearchStart
:
function
()
{
...
...
lms/static/js/spec/edxnotes/views/search_box_spec.js
View file @
cd01dc89
...
...
@@ -164,5 +164,11 @@ define([
' '
);
});
it
(
'can clear its input box'
,
function
()
{
this
.
searchBox
.
$
(
'.search-notes-input'
).
val
(
'search me'
);
this
.
searchBox
.
clearInput
();
expect
(
this
.
searchBox
.
$
(
'#search-notes-input'
).
val
()).
toEqual
(
''
);
});
});
});
lms/static/js/spec/edxnotes/views/tabs/search_results_spec.js
View file @
cd01dc89
...
...
@@ -146,12 +146,14 @@ define([
it
(
'can clear search results if tab is closed'
,
function
()
{
var
view
=
getView
(
this
.
tabsCollection
),
requests
=
AjaxHelpers
.
requests
(
this
);
spyOn
(
view
.
searchBox
,
'clearInput'
).
andCallThrough
();
submitForm
(
view
.
searchBox
,
'test_query'
);
Helpers
.
respondToRequest
(
requests
,
responseJson
,
true
);
expect
(
view
.
searchResults
).
toBeDefined
();
this
.
tabsCollection
.
at
(
0
).
destroy
();
expect
(
view
.
searchResults
).
toBeNull
();
expect
(
view
.
searchBox
.
clearInput
).
toHaveBeenCalled
();
});
it
(
'can correctly show/hide error messages'
,
function
()
{
...
...
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