##// END OF EJS Templates
outputarea.js: Wrap inline SVGs inside an iframe...
outputarea.js: Wrap inline SVGs inside an iframe When multiple inline SVGs are included in a single document, they share the same parse tree. Therefore, style collisions and use id collisions can occur and upset the rendering. This patch wraps each SVG inside an individual iframe, ensuring that SVG's declarations do not collide. (The SVG representation is kept as XML and not converted to a binary format, so I do not think this approach precludes the use of d3.js) Tested on: * Chrome Version 29.0.1547.57 Debian 7.1 (217859) * Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130806 Firefox/17.0 Iceweasel/17.0.8 Closes #1866

File last commit:

r13182:dd161051
r13408:333abbe5
Show More
test_files.py
51 lines | 1.5 KiB | text/x-python | PythonLexer
# coding: utf-8
"""Test the /files/ handler."""
import io
import os
from unicodedata import normalize
pjoin = os.path.join
import requests
from IPython.html.utils import url_path_join
from .launchnotebook import NotebookTestBase
from IPython.utils import py3compat
class FilesTest(NotebookTestBase):
def test_hidden_files(self):
not_hidden = [
u'å b',
pjoin(u'å b/ç. d')
]
hidden = [
u'.å b',
pjoin(u'å b/.ç d')
]
dirs = not_hidden + hidden
nbdir = self.notebook_dir.name
for d in dirs:
path = pjoin(nbdir, d.replace('/', os.sep))
if not os.path.exists(path):
os.mkdir(path)
with open(pjoin(path, 'foo'), 'w') as f:
f.write('foo')
with open(pjoin(path, '.foo'), 'w') as f:
f.write('.foo')
url = self.base_url()
for d in not_hidden:
path = pjoin(nbdir, d.replace('/', os.sep))
r = requests.get(url_path_join(url, 'files', d, 'foo'))
r.raise_for_status()
self.assertEqual(r.content, b'foo')
r = requests.get(url_path_join(url, 'files', d, '.foo'))
self.assertEqual(r.status_code, 403)
for d in hidden:
path = pjoin(nbdir, d.replace('/', os.sep))
for foo in ('foo', '.foo'):
r = requests.get(url_path_join(url, 'files', d, foo))
self.assertEqual(r.status_code, 403)