Skip to content

Commit

Permalink
Make access work when not autofilled
Browse files Browse the repository at this point in the history
Closes #399.
  • Loading branch information
valeriangalliat committed Jun 5, 2015
1 parent 8ba65b7 commit 7cc74fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.1.14

* Make `access` work when not autofilled ([#399](https://github.com/SassDoc/sassdoc/issues/399))

## 2.1.13

* Default destination is relative to CWD ([#403](https://github.com/SassDoc/sassdoc/pull/403))
Expand Down
9 changes: 9 additions & 0 deletions src/annotation/annotations/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ export default function access(env) {
return 'public';
},

resolve(data) {
data.forEach(item => {
// Ensure valid access when not autofilled.
if (item.access === 'auto') {
item.access = 'public';
}
});
},

default() {
return 'auto';
},
Expand Down
6 changes: 6 additions & 0 deletions test/annotations/access.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ describe('#access', function () {
assert.equal(access.autofill({ context: { name: 'private'}, access: 'private'}), undefined);
assert.equal(access.autofill({ context: { name: '_private-name'}, access: 'auto'}), 'private');
});

it('should work when not autofilled', function () {
var data = [{ access: 'auto' }];
access.resolve(data);
assert.equal(data[0].access, 'public');
});
});

0 comments on commit 7cc74fa

Please sign in to comment.