Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
jio
Commits
21458ee6
Commit
21458ee6
authored
Aug 20, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Officejs: do not redefine existing variable
parent
4ed1cec5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
78 deletions
+78
-78
examples/scenario_officejs.js
examples/scenario_officejs.js
+78
-78
No files found.
examples/scenario_officejs.js
View file @
21458ee6
...
...
@@ -79,13 +79,13 @@
function
equalStorage
(
storage
,
doc_tuple_list
)
{
return
storage
.
allDocs
()
.
push
(
function
(
result
)
{
var
i
,
var
j
,
promise_list
=
[];
for
(
i
=
0
;
i
<
result
.
data
.
rows
.
length
;
i
+=
1
)
{
for
(
j
=
0
;
j
<
result
.
data
.
rows
.
length
;
j
+=
1
)
{
promise_list
.
push
(
RSVP
.
all
([
result
.
data
.
rows
[
i
].
id
,
storage
.
get
(
result
.
data
.
rows
[
i
].
id
),
storage
.
getAttachment
(
result
.
data
.
rows
[
i
].
id
,
ATTACHMENT
)
result
.
data
.
rows
[
j
].
id
,
storage
.
get
(
result
.
data
.
rows
[
j
].
id
),
storage
.
getAttachment
(
result
.
data
.
rows
[
j
].
id
,
ATTACHMENT
)
]));
}
return
RSVP
.
all
(
promise_list
);
...
...
@@ -182,14 +182,14 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
;
var
t
ha
t
=
this
;
this
.
jio
.
repair
()
.
then
(
function
()
{
return
RSVP
.
all
([
isEmptyStorage
(
t
es
t
.
jio
),
isEmptyStorage
(
t
ha
t
.
jio
),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
}
)
]);
...
...
@@ -206,24 +206,24 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
blob
=
new
Blob
([
'
a
'
]);
putFullDoc
(
this
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
resetCount
(
test
.
remote_mock_options
.
count
);
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
equalStorage
(
t
es
t
.
jio
,
[[
doc_id
,
doc
,
blob
]]),
equalStorage
(
t
ha
t
.
jio
,
[[
doc_id
,
doc
,
blob
]]),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
}
)
]);
...
...
@@ -243,21 +243,21 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
blob
=
new
Blob
([
'
a
'
]);
putFullDoc
(
this
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
resetCount
(
t
es
t
.
remote_mock_options
.
count
);
return
t
es
t
.
jio
.
repair
();
resetCount
(
t
ha
t
.
remote_mock_options
.
count
);
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
equalStorage
(
t
es
t
.
jio
,
[[
doc_id
,
doc
,
blob
]]),
equalStorage
(
t
ha
t
.
jio
,
[[
doc_id
,
doc
,
blob
]]),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
,
get
:
1
,
getAttachment
:
1
,
allAttachments
:
1
}
)
]);
...
...
@@ -277,7 +277,7 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
doc2
=
{
title
:
doc_id
+
'
a
'
,
portal_type
:
"
Foo
"
,
modification_date
:
'
b
'
},
...
...
@@ -286,10 +286,10 @@
putFullDoc
(
this
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
putFullDoc
(
t
es
t
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc2
,
return
putFullDoc
(
t
ha
t
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc2
,
blob2
);
})
.
then
(
function
()
{
...
...
@@ -320,27 +320,27 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
blob
=
new
Blob
([
'
a
'
]);
putFullDoc
(
this
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
t
es
t
.
remote_mock_options
.
mock
.
buildQuery
=
function
()
{
t
ha
t
.
remote_mock_options
.
mock
.
buildQuery
=
function
()
{
return
[];
};
resetCount
(
t
es
t
.
remote_mock_options
.
count
);
return
t
es
t
.
jio
.
repair
();
resetCount
(
t
ha
t
.
remote_mock_options
.
count
);
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
isEmptyStorage
(
t
es
t
.
jio
),
isEmptyStorage
(
t
ha
t
.
jio
),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
}
)
]);
...
...
@@ -360,24 +360,24 @@
expect
(
3
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
abc
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
blob
=
new
Blob
([
'
a
'
]);
putFullDoc
(
this
.
jio
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
resetCount
(
t
es
t
.
remote_mock_options
.
count
);
return
t
es
t
.
jio
.
repair
();
resetCount
(
t
ha
t
.
remote_mock_options
.
count
);
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
equalStorage
(
t
es
t
.
jio
,
[[
t
es
t
.
remote_mock_options
.
last_post_id
,
doc
,
blob
]]
t
ha
t
.
jio
,
[[
t
ha
t
.
remote_mock_options
.
last_post_id
,
doc
,
blob
]]
),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
,
post
:
1
,
putAttachment
:
1
,
allAttachments
:
1
}
)
]);
...
...
@@ -403,7 +403,7 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
doc2
=
{
title
:
doc_id
+
'
a
'
,
portal_type
:
"
Foo
"
,
modification_date
:
'
b
'
},
...
...
@@ -413,24 +413,24 @@
putFullDoc
(
this
.
jio
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
last_id
=
t
es
t
.
remote_mock_options
.
last_post_id
;
return
putFullDoc
(
t
es
t
.
jio
,
last_id
,
doc2
,
blob2
);
last_id
=
t
ha
t
.
remote_mock_options
.
last_post_id
;
return
putFullDoc
(
t
ha
t
.
jio
,
last_id
,
doc2
,
blob2
);
})
.
then
(
function
()
{
resetCount
(
t
es
t
.
remote_mock_options
.
count
);
return
t
es
t
.
jio
.
repair
();
resetCount
(
t
ha
t
.
remote_mock_options
.
count
);
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
equalStorage
(
t
es
t
.
jio
.
__storage
.
_remote_sub_storage
,
t
ha
t
.
jio
.
__storage
.
_remote_sub_storage
,
[[
last_id
,
doc2
,
blob2
]]
),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
,
put
:
1
,
allAttachments
:
1
,
putAttachment
:
1
}
)
...
...
@@ -451,7 +451,7 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
doc2
=
{
title
:
doc_id
+
'
a
'
,
portal_type
:
"
Foo
"
,
modification_date
:
'
b
'
},
...
...
@@ -462,27 +462,27 @@
putFullDoc
(
this
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
putFullDoc
(
t
es
t
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
putFullDoc
(
t
ha
t
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc2
,
blob2
),
putFullDoc
(
t
es
t
.
jio
,
doc_id
,
doc3
,
blob3
)
putFullDoc
(
t
ha
t
.
jio
,
doc_id
,
doc3
,
blob3
)
]);
})
.
then
(
function
()
{
resetCount
(
t
es
t
.
remote_mock_options
.
count
);
return
t
es
t
.
jio
.
repair
();
resetCount
(
t
ha
t
.
remote_mock_options
.
count
);
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
equalStorage
(
t
es
t
.
jio
.
__storage
.
_remote_sub_storage
,
t
ha
t
.
jio
.
__storage
.
_remote_sub_storage
,
[[
doc_id
,
doc3
,
blob3
]]
),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
,
put
:
1
,
allAttachments
:
1
,
putAttachment
:
1
}
)
...
...
@@ -500,7 +500,7 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
doc2
=
{
title
:
doc_id
+
'
a
'
,
portal_type
:
"
Foo
"
,
modification_date
:
'
b
'
},
...
...
@@ -509,19 +509,19 @@
putFullDoc
(
this
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
putFullDoc
(
t
es
t
.
jio
,
doc_id
,
doc2
,
blob2
);
return
putFullDoc
(
t
ha
t
.
jio
,
doc_id
,
doc2
,
blob2
);
})
.
then
(
function
()
{
t
es
t
.
remote_mock_options
.
mock
.
put
=
function
()
{
t
ha
t
.
remote_mock_options
.
mock
.
put
=
function
()
{
throw
new
Error
(
'
put not allowed
'
);
};
t
es
t
.
remote_mock_options
.
mock
.
putAttachment
=
function
()
{
t
ha
t
.
remote_mock_options
.
mock
.
putAttachment
=
function
()
{
throw
new
Error
(
'
putattachment not allowed
'
);
};
resetCount
(
t
es
t
.
remote_mock_options
.
count
);
resetCount
(
t
ha
t
.
remote_mock_options
.
count
);
return
test
.
jio
.
repair
();
})
.
then
(
function
()
{
...
...
@@ -542,31 +542,31 @@
expect
(
3
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
blob
=
new
Blob
([
'
a
'
]);
putFullDoc
(
this
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
t
es
t
.
jio
.
remove
(
doc_id
);
return
t
ha
t
.
jio
.
remove
(
doc_id
);
})
.
then
(
function
()
{
resetCount
(
test
.
remote_mock_options
.
count
);
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
isEmptyStorage
(
t
es
t
.
jio
),
isEmptyStorage
(
t
ha
t
.
jio
),
equalStorage
(
t
es
t
.
jio
.
__storage
.
_remote_sub_storage
,
t
ha
t
.
jio
.
__storage
.
_remote_sub_storage
,
[[
doc_id
,
doc
,
blob
]]
),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
}
)
]);
...
...
@@ -583,30 +583,30 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
blob
=
new
Blob
([
'
a
'
]);
putFullDoc
(
this
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
t
es
t
.
jio
.
removeAttachment
(
doc_id
,
ATTACHMENT
);
return
t
ha
t
.
jio
.
removeAttachment
(
doc_id
,
ATTACHMENT
);
})
.
then
(
function
()
{
resetCount
(
test
.
remote_mock_options
.
count
);
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
equalStorage
(
t
es
t
.
jio
.
__storage
.
_remote_sub_storage
,
t
ha
t
.
jio
.
__storage
.
_remote_sub_storage
,
[[
doc_id
,
doc
,
blob
]]
),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
}
)
]);
...
...
@@ -623,7 +623,7 @@
expect
(
2
);
stop
();
var
t
es
t
=
this
,
var
t
ha
t
=
this
,
doc_id
=
'
foo_module/1
'
,
doc
=
{
title
:
doc_id
,
portal_type
:
"
Foo
"
,
modification_date
:
'
a
'
},
doc2
=
{
title
:
doc_id
+
'
a
'
,
portal_type
:
"
Foo
"
,
modification_date
:
'
b
'
},
...
...
@@ -632,31 +632,31 @@
putFullDoc
(
this
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc
,
blob
)
.
then
(
function
()
{
return
t
es
t
.
jio
.
repair
();
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
putFullDoc
(
t
es
t
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
putFullDoc
(
t
ha
t
.
jio
.
__storage
.
_remote_sub_storage
,
doc_id
,
doc2
,
blob2
),
t
es
t
.
jio
.
remove
(
doc_id
)
t
ha
t
.
jio
.
remove
(
doc_id
)
]);
})
.
then
(
function
()
{
resetCount
(
t
es
t
.
remote_mock_options
.
count
);
return
t
es
t
.
jio
.
repair
();
resetCount
(
t
ha
t
.
remote_mock_options
.
count
);
return
t
ha
t
.
jio
.
repair
();
})
.
then
(
function
()
{
return
RSVP
.
all
([
equalStorage
(
t
es
t
.
jio
,
t
ha
t
.
jio
,
[[
doc_id
,
doc2
,
blob2
]]
),
equalStorage
(
t
es
t
.
jio
.
__storage
.
_remote_sub_storage
,
t
ha
t
.
jio
.
__storage
.
_remote_sub_storage
,
[[
doc_id
,
doc2
,
blob2
]]
),
equalRemoteStorageCallCount
(
t
es
t
.
remote_mock_options
.
count
,
t
ha
t
.
remote_mock_options
.
count
,
{
buildQuery
:
1
,
get
:
1
,
allAttachments
:
1
,
getAttachment
:
1
}
)
...
...
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