Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio_mebibou
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
Alexandra Rogova
jio_mebibou
Commits
5d6b82d1
Commit
5d6b82d1
authored
Dec 27, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fake localStorage writen for jiotests
parent
4a01d505
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
test/browserlocalstorage.stub.js
test/browserlocalstorage.stub.js
+62
-0
No files found.
test/browserlocalstorage.stub.js
0 → 100644
View file @
5d6b82d1
"
use strict
"
;
var
localStorage
=
{};
// clear
Object
.
defineProperty
(
localStorage
,
"
clear
"
,{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
()
{
var
k
;
for
(
k
in
this
)
{
delete
this
[
k
];
}
}
});
// key
Object
.
defineProperty
(
localStorage
,
"
key
"
,{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
n
)
{
var
i
,
k
;
if
(
n
<
0
||
n
>=
this
.
length
)
{
return
null
;
}
for
(
k
in
this
)
{
if
(
i
===
n
)
{
return
k
;
}
i
+=
1
}
return
null
;
}
});
// length
Object
.
defineProperty
(
localStorage
,
"
length
"
,{
configurable
:
false
,
enumerable
:
false
,
writable
:
true
,
value
:
0
});
// toString
Object
.
defineProperty
(
localStorage
,
"
toString
"
,{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
k
,
v
)
{
return
"
[object Storage]
"
;
}
});
// setItem
Object
.
defineProperty
(
localStorage
,
"
setItem
"
,{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
k
,
v
)
{
if
(
typeof
this
[
k
]
===
"
undefined
"
&&
typeof
v
!==
"
undefined
"
)
{
this
.
length
+=
1
;
}
this
[
k
]
=
v
.
toString
();
}
});
// getItem
Object
.
defineProperty
(
localStorage
,
"
getItem
"
,{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
k
)
{
return
this
[
k
]
===
undefined
?
null
:
this
[
k
];
}
});
// removeItem
Object
.
defineProperty
(
localStorage
,
"
removeItem
"
,{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
k
)
{
if
(
typeof
this
[
k
]
!==
"
undefined
"
)
{
this
.
length
-=
1
;
}
delete
this
[
k
];
}
});
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