Pārlūkot izejas kodu

fix add-file btn so that it also works if nav is made from home

Benoît Hubert 8 gadi atpakaļ
vecāks
revīzija
021c1ded03

+ 9 - 2
css/styles.css

@@ -368,14 +368,21 @@ input {
   color: #7af;
 }
 
-#tabs {
+#tabs, #add-file {
+  display: inline-block;
   /*font-size: 16px;*/
   position: relative;
   vertical-align: bottom;
   margin: 0;
+}
+#tabs {
   padding-left: 10px;
 }
-#tabs li {
+#add-file {
+  padding-left: 5px;
+}
+#tabs li,
+#add-file li {
   border-top: 1px solid #ddd;
   border-left: 1px solid #ddd;
   border-right: 1px solid #ddd;

+ 4 - 4
html/index.mustache.html

@@ -90,7 +90,8 @@
             <ul id="tabs">{{#files}}
                 <li class="tab-{{type}}" data-type="{{type}}">{{name}}</li>
             {{/files}}
-            <li id="add-file"><button class="add-btn inline-block h-collapsed fast{{#repo}} in{{/repo}}">+</button>
+            </ul><ul id="add-file">
+            <li><button class="add-btn inline-block h-collapsed fast{{#repo}} in{{/repo}}">+</button>
                 <form class="inline-block h-collapsed">
                     <input type="text" name="title" class="input-xs input-light-border" value="" placeholder="{{_.fileNameWithExt}}" required />
                     <button type="button" id="add-example-cancel" class="icon-cross"></button><!--
@@ -137,10 +138,9 @@
 </script>
 
 <script data-tmpl-for="tabs" id="tabs-tmpl" type="text/x-mustache-tmpl">
-  {{#files}}
+{{#files}}
     <li class="tab-{{type}}" data-type="{{type}}">{{name}}</li>
-  {{/files}}
-  <li>+</li>
+{{/files}}
 </script>
 
 <script data-tmpl-for="details-repo" id="details-example-repo" type="text/x-mustache-tmpl">

+ 8 - 6
js/test/ws.test.js

@@ -87,12 +87,14 @@ function timeoutAsync(cb, delay) {
 
     QUnit.test( "test adding a collection", function( assert ) {
       var done = assert.async();
-      var $addCollectionForm = $('#add-collection-form');
-      var $addCollectionBtn  = $('#add-collection-btn');
-      assert.equal( $addCollectionForm.length, 1, "there should be one #add-collection-form element" );
-      assert.equal( $addCollectionBtn.length, 1, "there should be one #add-collection-btn element" );
-      $addCollectionBtn.trigger( 'click' );
-      assert.ok( $addCollectionForm.is(':visible'), "clicking on #add-collection-btn should make appear the *-form element" );
+      var $addRepo = $('#add-repo');
+      var $addRepoAddBtn = $addRepo.find('.add-btn');
+      var $addRepoForm = $addRepo.find('form');
+      assert.equal( $addRepo.length, 1, "there should be one #add-repo element" );
+      assert.equal( $addRepoForm.length, 1, "#add-repo should contain one form element" );
+      assert.ok( $addRepoForm.is(':visible'), "the form element shouldn't be visible before clicking the + btn" );
+      $addRepoAddBtn.trigger( 'click' );
+      assert.ok( $addRepoForm.is(':visible'), "clicking on the + btn should have made the form appear" );
 
       done();
     });

+ 2 - 2
test/integration/test-examples/example-repo2/repo2-example1/config.json

@@ -1,8 +1,8 @@
 {
   "title": "Random Example",
   "category": "random-stuff",
-  "html": [ "example.html" ],
-  "js": [ "script.js" ],
+  "html": [ "example.html", "poupou.html" ],
+  "js": [ "script.js", "pouet.js" ],
   "css": [],
   "libsJs": [],
   "libsCss": [ "styles.css" ]