Преглед изворни кода

test fonctionels pour recupe data auprés des api (controlleur) et fix js: champs de sisie non emcombré après clic sur un tag de proposition

Sevajol Bastien пре 12 година
родитељ
комит
ee8bde5412

+ 61 - 0
src/Muzich/CoreBundle/Tests/Controller/ElementControllerTest.php Прегледај датотеку

@@ -1296,4 +1296,65 @@ class ElementControllerTest extends FunctionalTest
1296 1296
     
1297 1297
   }
1298 1298
   
1299
+  public function testDatasApi()
1300
+  {
1301
+    $this->client = self::createClient();
1302
+    $this->connectUser('joelle', 'toor');
1303
+    
1304
+    $joelle = $this->getUser();
1305
+    $url = $this->generateUrl('element_retrieve_api_datas');
1306
+    
1307
+    $crawler = $this->client->request(
1308
+      'POST', 
1309
+      $url, 
1310
+      array(
1311
+        'url' => 'http://www.jamendo.com/fr/album/30661'
1312
+      ), 
1313
+      array(), 
1314
+      array('HTTP_X-Requested-With' => 'XMLHttpRequest')
1315
+    );
1316
+    
1317
+    $this->isResponseSuccess();
1318
+    
1319
+    $response = json_decode($this->client->getResponse()->getContent(), true);
1320
+    $this->assertEquals(array(
1321
+    'status' => 'success',
1322
+    'name' => 'ZwaNe 01 - Ptit lutin',
1323
+    'tags' => array(
1324
+      0 => array(
1325
+        'original_name' => 'Basse',
1326
+        'like_found' => false,
1327
+        'like' => array()
1328
+      ),
1329
+      1 => array(
1330
+        'original_name' => 'Batterie',
1331
+        'like_found' => true,
1332
+        'like' => array(
1333
+          'name' => 'Batterie',
1334
+          'id' => '495',
1335
+          'slug' => 'batterie',
1336
+        )
1337
+      ),
1338
+      2 => array(
1339
+        'original_name' => 'Hardtek',
1340
+        'like_found' => true,
1341
+        'like' => array(
1342
+          'name' => 'Hardtek',
1343
+          'id' => '174',
1344
+          'slug' => 'hardtek',
1345
+        )
1346
+      ),
1347
+      3 => array(
1348
+        'original_name' => 'Tek',
1349
+        'like_found' => false,
1350
+        'like' => array()
1351
+      ),
1352
+    ),
1353
+    'thumb' => 'http://imgjam.com/albums/s30/30661/covers/1.100.jpg'
1354
+    ), $response);
1355
+    
1356
+    
1357
+    
1358
+  }
1359
+  
1299 1360
 }

+ 3 - 0
web/bundles/muzichcore/js/muzich.js Прегледај датотеку

@@ -1276,6 +1276,9 @@ $(document).ready(function(){
1276 1276
       form_add_open_dialog_for_new_tag($(this), input_tag, form_name, divtags);
1277 1277
     }
1278 1278
     
1279
+    // On nettoie le champs de saisie des tags
1280
+    $('input.form-default-value-processed').val('');
1281
+    
1279 1282
   });
1280 1283
   
1281 1284
   // #ajouter ajouter un élément (envoi du formulaire)