##// END OF EJS Templates
Reverse hscrollbar min-height hack on OS X...
Reverse hscrollbar min-height hack on OS X OS X has optional behavior to only draw scrollbars during scroll, which causes problems for CodeMirror's scrollbars. CodeMirror's solution is to set a minimum size for their scrollbars, which is always present. The trade is that the container overlays most of the last line, swallowing click events when there is scrolling to do, even when no scrollbar is visible. This reverses the trade, recovering the click events at the expense of never showing the horizontal scrollbar on OS X when this option is enabled.

File last commit:

r18580:ba8461eb
r20298:2907e856
Show More
test_highlightmagics.py
49 lines | 1.6 KiB | text/x-python | PythonLexer
MinRK
update nbconvert to nbformat 4
r18580 """Tests for the HighlightMagics preprocessor"""
Pablo de Oliveira
Add HighlightMagicsPreprocessor...
r12573
from .base import PreprocessorTestsBase
from ..highlightmagics import HighlightMagicsPreprocessor
class TestHighlightMagics(PreprocessorTestsBase):
"""Contains test functions for highlightmagics.py"""
def build_preprocessor(self):
"""Make an instance of a preprocessor"""
preprocessor = HighlightMagicsPreprocessor()
preprocessor.enabled = True
return preprocessor
def test_constructor(self):
"""Can a HighlightMagicsPreprocessor be constructed?"""
self.build_preprocessor()
def test_tagging(self):
"""Test the HighlightMagicsPreprocessor tagging"""
nb = self.build_notebook()
res = self.build_resources()
preprocessor = self.build_preprocessor()
MinRK
update nbconvert to nbformat 4
r18580 nb.cells[0].source = """%%R -i x,y -o XYcoef
Pablo de Oliveira
Add HighlightMagicsPreprocessor...
r12573 lm.fit <- lm(y~x)
par(mfrow=c(2,2))
print(summary(lm.fit))
plot(lm.fit)
XYcoef <- coef(lm.fit)"""
nb, res = preprocessor(nb, res)
MinRK
update nbconvert to nbformat 4
r18580 assert('magics_language' in nb.cells[0]['metadata'])
Pablo de Oliveira
Add HighlightMagicsPreprocessor...
r12573
MinRK
update nbconvert to nbformat 4
r18580 self.assertEqual(nb.cells[0]['metadata']['magics_language'], 'r')
Pablo de Oliveira
Add HighlightMagicsPreprocessor...
r12573
def test_no_false_positive(self):
"""Test that HighlightMagicsPreprocessor does not tag false positives"""
nb = self.build_notebook()
res = self.build_resources()
preprocessor = self.build_preprocessor()
MinRK
update nbconvert to nbformat 4
r18580 nb.cells[0].source = """# this should not be detected
Pablo de Oliveira
Add HighlightMagicsPreprocessor...
r12573 print(\"""
%%R -i x, y
\""")"""
nb, res = preprocessor(nb, res)
MinRK
update nbconvert to nbformat 4
r18580 assert('magics_language' not in nb.cells[0]['metadata'])