Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ec002ef7
Commit
ec002ef7
authored
Apr 07, 2020
by
Jan Beckmann
Committed by
Phil Hughes
Apr 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix display of Jupyter notebooks where cell.source is a string
Fixes #27374
parent
1ca49703
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
14 deletions
+38
-14
app/assets/javascripts/notebook/cells/code.vue
app/assets/javascripts/notebook/cells/code.vue
+2
-2
changelogs/unreleased/27374-jupyter-notebook-cellsource.yml
changelogs/unreleased/27374-jupyter-notebook-cellsource.yml
+5
-0
spec/javascripts/notebook/cells/code_spec.js
spec/javascripts/notebook/cells/code_spec.js
+31
-12
No files found.
app/assets/javascripts/notebook/cells/code.vue
View file @
ec002ef7
...
...
@@ -21,11 +21,11 @@ export default {
},
computed
:
{
rawInputCode
()
{
if
(
this
.
cell
.
source
)
{
if
(
this
.
cell
.
source
&&
Array
.
isArray
(
this
.
cell
.
source
)
)
{
return
this
.
cell
.
source
.
join
(
''
);
}
return
''
;
return
this
.
cell
.
source
||
''
;
},
hasOutput
()
{
return
this
.
cell
.
outputs
.
length
;
...
...
changelogs/unreleased/27374-jupyter-notebook-cellsource.yml
0 → 100644
View file @
ec002ef7
---
title
:
Fix display of PyCharm generated Jupyter notebooks
merge_request
:
28810
author
:
Jan Beckmann
type
:
fixed
spec/javascripts/notebook/cells/code_spec.js
View file @
ec002ef7
...
...
@@ -11,14 +11,19 @@ describe('Code component', () => {
json
=
getJSONFixture
(
'
blob/notebook/basic.json
'
);
});
const
setupComponent
=
cell
=>
{
const
comp
=
new
Component
({
propsData
:
{
cell
,
},
});
comp
.
$mount
();
return
comp
;
};
describe
(
'
without output
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
=
new
Component
({
propsData
:
{
cell
:
json
.
cells
[
0
],
},
});
vm
.
$mount
();
vm
=
setupComponent
(
json
.
cells
[
0
]);
setTimeout
(()
=>
{
done
();
...
...
@@ -32,12 +37,7 @@ describe('Code component', () => {
describe
(
'
with output
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
=
new
Component
({
propsData
:
{
cell
:
json
.
cells
[
2
],
},
});
vm
.
$mount
();
vm
=
setupComponent
(
json
.
cells
[
2
]);
setTimeout
(()
=>
{
done
();
...
...
@@ -52,4 +52,23 @@ describe('Code component', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.output
'
)).
toBeDefined
();
});
});
describe
(
'
with string for cell.source
'
,
()
=>
{
beforeEach
(
done
=>
{
const
cell
=
json
.
cells
[
0
];
cell
.
source
=
cell
.
source
.
join
(
''
);
vm
=
setupComponent
(
cell
);
setTimeout
(()
=>
{
done
();
});
});
it
(
'
renders the same input as when cell.source is an array
'
,
()
=>
{
const
expected
=
"
console.log('test')
"
;
expect
(
vm
.
$el
.
querySelector
(
'
.input
'
).
innerText
).
toContain
(
expected
);
});
});
});
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