cgarvis / angular-toggle-switch

AngularJS Toggle Switch
http://cgarvis.github.io/angular-toggle-switch
MIT License
160 stars 124 forks source link

Fix missing on and off labels, add knob-labels, plus tests. #8

Closed Hypercubed closed 11 years ago

Hypercubed commented 11 years ago

Ok, let's try again. This should be clean. Forked from your master.

Changes:

1) Added .bowerrc. Bower was not using the correct directory on my machine because a .bowerrc file was found in a parent directory. 2) Fixed issue when labels were not specified by using attr. instead of $scope.. 3) Added tests for default labels. 4) Added knobLabel and tests.

cgarvis commented 11 years ago

i believe .bowerrc should be put in your project's repo not the library's.

Hypercubed commented 11 years ago

Yes, but Karma is looking for angularjs in the angular-toggle-switch directory. bower install, even when run from the /angular-toggle-switch sub-directory is putting the dependencies in the project directory.

Here is an example of how I think this is fixed. Perhaps there is a better way? I guess you don't see this problem if you are not running karma under your project directory.

myproject
+- .bowerrc                    <-- This tells bower to put my components into ./bower_components below
+- bower_components                           
    +- angular-toggle-switch/
        +- components/         <-- Karma looks for angular here
        +- .bowerc             <-- I think this is needed to make sure `bower install` in this directory uses ./components
cgarvis commented 11 years ago

I run tests using 2 consoles. One runs grunt watch and the other runs grunt karma:unit. Is this how you are running tests? Are you working on this within another project?

Hypercubed commented 11 years ago

Basically, because I am building and testing angular-toggle-switch within another project I need .bowerrc to isolate angular-toggle-switch from the project. I didn't think there was any harm adding a .bowerrc. Feel free to reject it.

cgarvis commented 11 years ago

I want to get your knob code in. Can you cherry pick that onto a new branch and make a new PR? We can then work through the default attrs stuff on another PR.

cgarvis commented 11 years ago

Default labels are now fixed in 8fabe8216cab54a5c72f34d87986d5aa771618ce

Hypercubed commented 11 years ago

Great!