Ejemplo n.º 1
0
 def test_can_bundle_a_jsx_component(self):
     bundle = bundle_component(Components.HELLO_WORLD_JSX, translate=True)
     asset = bundle.get_assets()[0]
     self.assertTrue(os.path.exists(asset['path']))
     with open(asset['path'], 'r') as asset_file:
         contents = asset_file.read()
         self.assertIn('// __WEBPACK_TRANSLATE_BUNDLE_TEST__', contents)
Ejemplo n.º 2
0
 def test_can_pass_props_when_rendering_a_bundled_jsx_component(self):
     bundle = bundle_component(Components.HELLO_WORLD_JSX, translate=True)
     asset = bundle.get_assets()[0]
     component = render_component(asset['path'],
                                  props={'name': 'world!'},
                                  to_static_markup=True)
     self.assertEqual(str(component), '<span>Hello world!</span>')
Ejemplo n.º 3
0
 def test_can_bundle_a_jsx_component(self):
     bundle = bundle_component(Components.HELLO_WORLD_JSX, translate=True)
     asset = bundle.get_assets()[0]
     self.assertTrue(os.path.exists(asset['path']))
     with open(asset['path'], 'r') as asset_file:
         contents = asset_file.read()
         self.assertIn('// __WEBPACK_TRANSLATE_BUNDLE_TEST__', contents)
Ejemplo n.º 4
0
 def test_can_pass_props_when_rendering_a_bundled_jsx_component(self):
     bundle = bundle_component(Components.HELLO_WORLD_JSX, translate=True)
     asset = bundle.get_assets()[0]
     component = render_component(asset['path'], props={'name': 'world!'}, to_static_markup=True)
     self.assertEqual(
         str(component),
         '<span>Hello world!</span>'
     )
Ejemplo n.º 5
0
 def test_bundled_components_omit_react_and_react_addons(self):
     bundle = bundle_component(Components.REACT_ADDONS, translate=True)
     with open(bundle.get_assets()[0]['path'], 'r') as bundle_file:
         content = bundle_file.read()
     # A bit hacky, but seems to work
     self.assertNotIn('Facebook', content)
Ejemplo n.º 6
0
 def test_can_render_a_bundled_jsx_component(self):
     bundle = bundle_component(Components.HELLO_WORLD_JSX, translate=True)
     asset = bundle.get_assets()[0]
     component = render_component(asset['path'], to_static_markup=True)
     self.assertEqual(str(component), '<span>Hello </span>')
Ejemplo n.º 7
0
 def test_bundled_components_omit_react_and_react_addons(self):
     bundle = bundle_component(Components.REACT_ADDONS, translate=True)
     with open(bundle.get_assets()[0]['path'], 'r') as bundle_file:
         content = bundle_file.read()
     # A bit hacky, but seems to work
     self.assertNotIn('Facebook', content)
Ejemplo n.º 8
0
 def test_can_render_a_bundled_jsx_component(self):
     bundle = bundle_component(Components.HELLO_WORLD_JSX, translate=True)
     asset = bundle.get_assets()[0]
     component = render_component(asset['path'], to_static_markup=True)
     self.assertEqual(str(component), '<span>Hello </span>')