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
Show 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 {
...
@@ -21,11 +21,11 @@ export default {
},
},
computed
:
{
computed
:
{
rawInputCode
()
{
rawInputCode
()
{
if
(
this
.
cell
.
source
)
{
if
(
this
.
cell
.
source
&&
Array
.
isArray
(
this
.
cell
.
source
)
)
{
return
this
.
cell
.
source
.
join
(
''
);
return
this
.
cell
.
source
.
join
(
''
);
}
}
return
''
;
return
this
.
cell
.
source
||
''
;
},
},
hasOutput
()
{
hasOutput
()
{
return
this
.
cell
.
outputs
.
length
;
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', () => {
...
@@ -11,14 +11,19 @@ describe('Code component', () => {
json
=
getJSONFixture
(
'
blob/notebook/basic.json
'
);
json
=
getJSONFixture
(
'
blob/notebook/basic.json
'
);
});
});
describe
(
'
without output
'
,
()
=>
{
const
setupComponent
=
cell
=>
{
beforeEach
(
done
=>
{
const
comp
=
new
Component
({
vm
=
new
Component
({
propsData
:
{
propsData
:
{
cell
:
json
.
cells
[
0
]
,
cell
,
},
},
});
});
vm
.
$mount
();
comp
.
$mount
();
return
comp
;
};
describe
(
'
without output
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
=
setupComponent
(
json
.
cells
[
0
]);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
done
();
done
();
...
@@ -32,12 +37,7 @@ describe('Code component', () => {
...
@@ -32,12 +37,7 @@ describe('Code component', () => {
describe
(
'
with output
'
,
()
=>
{
describe
(
'
with output
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
done
=>
{
vm
=
new
Component
({
vm
=
setupComponent
(
json
.
cells
[
2
]);
propsData
:
{
cell
:
json
.
cells
[
2
],
},
});
vm
.
$mount
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
done
();
done
();
...
@@ -52,4 +52,23 @@ describe('Code component', () => {
...
@@ -52,4 +52,23 @@ describe('Code component', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.output
'
)).
toBeDefined
();
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